Get a copy of the type from the cache, or create a new one.
198232
def get_or_create(cls, **kwargs):
        """"""

        data = cls._get(**kwargs)
        if data is None:
            return cls(**kwargs), True
        return cls.deserialize(data), False
528420
def create(client, _type, **kwargs):
    """"""
    obj = client.factory.create("ns0:%s" % _type)
    for key, value in kwargs.items():
        setattr(obj, key, value)
    return obj
496225
protected static function initializeCache($type)
    {
        if (self::$cache === null) {
            self::$cache = new \stdClass();
        }

        if (!property_exists(self::$cache, $type)) {
            self::$cache->{$type} = new \stdClass();
        }
    }
392761
def collect_by_type(obj_sequence, cache=None):
    

    if cache is None:
        cache = {}

    for val in obj_sequence:
        key = type(val)

        bucket = cache.get(key, None)
        if bucket is not None:
            bucket.append(val)
        else:
            cache[key] = [val]

    return cache
797826
def _get_cache_value(self, key, empty, type):
        """"""
        if type is bool:
            return key in self
        if key in self:
            value = self[key]
            if value is None:
                return empty
            elif type is not None:
                try:
                    value = type(value)
                except ValueError:
                    pass
            return value
1370519
<T extends ClassFileDescriptor> TypeCache.CachedType<T> createType(String fullQualifiedName, FileDescriptor fileDescriptor, Class<T> descriptorType) {
        return getTypeResolver().create(fullQualifiedName, fileDescriptor, descriptorType, scannerContext);
    }
410955
def supported_cache_type(types):
    
    if isinstance(types, str):
        types = [typ.strip() for typ in types.split(",")]
    for typ in types:
        if typ not in ["reflink", "hardlink", "symlink", "copy"]:
            return False
    return True
739277
static public <T extends Iced> T deepCopy(T iced) {
    if (iced == null) return null;
    AutoBuffer ab = new AutoBuffer();
    iced.write(ab);
    ab.flipForReading();
    // Create a new instance
    return (T) TypeMap.newInstance(iced.frozenType()).read(ab);
  }
955063
public static <T> T get(Class<T> type) {
        FactoryBuilder factoryBuilder = REPOSITORY.get(type);
        return (T) factoryBuilder.get();
    }
176197
def copy(self) :
        ""
        result = dbus.dbus_message_copy(self._dbobj)
        if result == None :
            raise CallFailed("dbus_message_copy")
        #end if
        return \
            type(self)(result)
1214836
private <T> T newInstance(DatastoreId id, DatastoreType datastoreType, DynamicType<?> types, TransactionalCache.Mode cacheMode) {
        validateType(types);
        InstanceInvocationHandler invocationHandler = new InstanceInvocationHandler(datastoreType, getProxyMethodService());
        T instance = proxyFactory.createInstance(invocationHandler, types.getCompositeType());
        cache.put(id, instance, cacheMode);
        return instance;
    }
1361678
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();
    }
  }
1073042
public static <S> ClassTypeInformation<S> from(Class<S> type) {

        LettuceAssert.notNull(type, "Type must not be null!");

        Reference<ClassTypeInformation<?>> cachedReference = CACHE.get(type);
        TypeInformation<?> cachedTypeInfo = cachedReference == null ? null : cachedReference.get();

        if (cachedTypeInfo != null) {
            return (ClassTypeInformation<S>) cachedTypeInfo;
        }

        ClassTypeInformation<S> result = new ClassTypeInformation<S>(type);
        CACHE.put(type, new WeakReference<ClassTypeInformation<?>>(result));
        return result;
    }
1080506
public static <SOURCE, TARGET> PropertyCopier<SOURCE, TARGET> getInstance(Typed<SOURCE> sourceType,
        Typed<TARGET> targetType, Mapping mapping, Matching matching) {
        return new FromFactory<>(Validate.notNull(sourceType, "sourceType"), Validate.notNull(targetType, "targetType"),
            mapping, matching);
    }
903997
public static Types instance(Context context) {
        Types instance = context.get(typesKey);
        if (instance == null)
            instance = new Types(context);
        return instance;
    }
1038103
def copy(self):
        

        copy = MOC(name=self.name, mocid=self.id,
                   origin=self.origin, moctype=self.type)

        copy += self

        return copy
1043748
def copy(self):
        """"""
        return self.__class__(key=self._key, load=self._load, _set=set(self._set))