code: private Mapper createMapper(Type type) {
      lock.lock();
      try {
        Mapper mapper = cache.get(type);
        if (mapper != null) {
          return mapper;
        }
        if (type instanceof Class) {
          mapper = createMapper((Class<?>) type);
        } else if (type instanceof ParameterizedType) {
          mapper = createMapper((ParameterizedType) type);
        } else {
          throw new IllegalArgumentException(
              String.format("Type %s is neither a Class nor ParameterizedType", type));
        }
        cache.put(type, mapper);
        return mapper;
      } finally {
        lock.unlock();
      }
    }
docs: Creates a new mapper for the given type.
  
  @param type
  the type for which a mapper is to be created
  @return a mapper that can handle the mapping of given type to/from the Cloud Datastore.