Factory method

@param <IDTYPE>
The type of the ID.
@param aObjectType
Object type to use. May not be <code>null</code>.
@param aID
ID to be used. May not be <code>null</code>.
@return new {@link TypedObject}
434261
@Nonnull
  public static <IDTYPE extends Serializable> TypedObject <IDTYPE> create (@Nonnull final ObjectType aObjectType,
                                                                           @Nonnull final IDTYPE aID)
  {
    return new TypedObject <> (aObjectType, aID);
  }
1239445
def create(cls, object_type=None, object_uuid=None, **kwargs):
        
        assert 'pid_value' in kwargs

        kwargs.setdefault('status', cls.default_status)
        if object_type and object_uuid:
            kwargs['status'] = PIDStatus.REGISTERED

        return super(OAIIDProvider, cls).create(
            object_type=object_type, object_uuid=object_uuid, **kwargs)
1361514
public static <V> Optional<V> associated(Associator associator,
            Class<V> type, Serializable id) {
        return associator.associated(new TypedIdKey<>(type, id), type);
    }
877024
public static Object[] cast(Class<?> type, Object arrayObj) throws NullPointerException, IllegalArgumentException {
		if (null == arrayObj) {
			throw new NullPointerException("Argument [arrayObj] is null !");
		}
		if (false == arrayObj.getClass().isArray()) {
			throw new IllegalArgumentException("Argument [arrayObj] is not array !");
		}
		if (null == type) {
			return (Object[]) arrayObj;
		}

		final Class<?> componentType = type.isArray() ? type.getComponentType() : type;
		final Object[] array = (Object[]) arrayObj;
		final Object[] result = ArrayUtil.newArray(componentType, array.length);
		System.arraycopy(array, 0, result, 0, array.length);
		return result;
	}
415943
public static <T> Interface<T> type(Class<T> anyInterface) {
    class InterfaceType extends Interface<T> {
      InterfaceType() {
        super(anyInterface);
      }
    }

    Objects.requireNonNull(anyInterface, "anyInterface");
    Assert.ensure(anyInterface.isInterface(), "anyInterface.isInterface()");

    return new InterfaceType();
  }
844287
public Factory registerObject(Object obj, String id) {
        return registerObject(obj, id, true);
    }
1080813
public <T extends Entity<ID>, ID extends Serializable> T newInstance(final Class<T> clazz, final ID id) {
    EntityType type = getEntityType(clazz);
    @SuppressWarnings("unchecked")
    T entity = (T) type.newInstance();
    try {
      PropertyUtils.setProperty(entity, type.getIdName(), id);
    } catch (Exception e) {
      logger.error("initialize {} with id {} error", clazz, id);
    }
    return entity;
  }
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
465904
private <K, T extends Persistable<K>> CastorDao<K, T> _createDao(
                    final Class<T> type
                    )
    {
        String  daoClazzName = _typeMapping.get( type.getName() );
        if (_LOG_.isDebugEnabled()) {
            _LOG_.debug( "creating Dao: object type=" + type
                            + ", Dao type=" + daoClazzName );
        }

        CastorDao<K, T>  dao = null;
        if (daoClazzName == null) {
            dao = new CastorDao<K, T>( type );
        } else {
            try {
                @SuppressWarnings( "unchecked" )
                Class<CastorDao<K, T>>  daoClazz =
                    (Class<CastorDao<K, T>>)Class.forName( daoClazzName );
                dao = daoClazz.newInstance();
                               //throws InstantiationException, IllegalAccessException
            } catch (Exception ex) {
                throw new PersistenceException( ex );
            }
        }

        if (CastorDaoSupport.class.isInstance( dao )) {
            CastorDaoSupport  support = CastorDaoSupport.class.cast( dao );
            support.setJDOManager( _jdoManager );
        }

        return dao;
    }
321204
@SneakyThrows
    public <T extends SOAPObject> T newSoapObject(final Class<T> objectType) {
        val qName = getSamlObjectQName(objectType);
        val builder = (SOAPObjectBuilder<T>)
            XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName);
        if (builder == null) {
            throw new IllegalStateException("No SAML object builder is registered for class " + objectType.getName());
        }
        return objectType.cast(builder.buildObject(qName));
    }
218844
public <V> AttributeTypeImpl<V> buildAttributeType(VertexElement vertex, AttributeType<V> type, AttributeType.DataType<V> dataType) {
        return getOrBuildConcept(vertex, (v) -> AttributeTypeImpl.create(v, type, dataType));
    }
367210
public Object newInstanceWithId(final Object id)
	{
		try
		{
			final Object o = clazz.newInstance();

			idProperty.set(o, id);

			return o;
		}
		catch (Throwable e)
		{
			throw new RuntimeException("Cannot create new instance of " +
			                           clazz +
			                           " with ID " +
			                           id +
			                           " (of type " +
			                           id.getClass() +
			                           ") populated!", e);
		}
	}
327167
@Override
    public IDataType onTypeFault(String typeName) throws AtlasException {

        // Type is not cached - check the type store.
        // Any super and attribute types needed by the requested type
        // which are not cached will also be loaded from the store.
        Context context = new Context();
        TypesDef typesDef = getTypeFromStore(typeName, context);
        if (typesDef.isEmpty()) {
            // Type not found in the type store.
            return null;
        }

        // Add all types that were loaded from the store to the cache.
        TransientTypeSystem transientTypeSystem = typeSystem.createTransientTypeSystem(context.getTypesDef(), false);
        Map<String, IDataType> typesAdded = transientTypeSystem.getTypesAdded();
        putAll(typesAdded.values());
        return typesAdded.get(typeName);
    }
207961
public <T> DomainObjectMatch<T> createMatch(Class<T> domainObjectType) {
		DomainObjectMatch<T> ret = createMatchInternal(domainObjectType);
		QueryRecorder.recordAssignment(this, "createMatch", ret,
				QueryRecorder.literal(domainObjectType.getName()));
		return ret;
	}
113787
def create(self, type_, **kwargs):
        
        obj = self.factory.create("ns0:%s" % type_)
        for key, value in kwargs.items():
            setattr(obj, key, value)
        return obj
1187490
public static <T> T prop(JavaScriptObject o, Object id, Class<? extends T> type) {
    return o == null ? null : o.<JsCache> cast().get(id, type);
  }
1326325
public Injector createInjector() {
        for (final TypeLiteral<?> typeLiteral : _inheritedTypeLiterals) {
            final Key<?> key = Key.get(typeLiteral);
            final Binding<?> binding = _parentInjector.getExistingBinding(key);
            if (binding != null) {
                if (!_adHocModule.hasBindingFor(typeLiteral)) {
                    // Bind entry if not already bound in adhoc module!!!
                    _adHocModule.bind(typeLiteral, binding.getProvider());
                }
            }
        }

        final Module module = Modules.override(_parentModule).with(_adHocModule);
        return Guice.createInjector(module);
    }