Returns a factory class to instantiate a certain class.

@param classDefinition the class that is to be instantiated.
@param <T> the type of the class to be instantiated.

@return a factory method for the specified class.
192125
@Nullable
    public <T> Class<Provider<T>> getScopedFactoryClass(Class scope, Class<T> classDefinition) {
        //noinspection unchecked
        return (Class)factoryClasses.getScope(scope).get(classDefinition);
    }
915488
@Internal
	public static <OUT> TypeInfoFactory<OUT> getTypeInfoFactory(Type t) {
		final Class<?> factoryClass;
		if (registeredTypeInfoFactories.containsKey(t)) {
			factoryClass = registeredTypeInfoFactories.get(t);
		}
		else {
			if (!isClassType(t) || !typeToClass(t).isAnnotationPresent(TypeInfo.class)) {
				return null;
			}
			final TypeInfo typeInfoAnnotation = typeToClass(t).getAnnotation(TypeInfo.class);
			factoryClass = typeInfoAnnotation.value();
			// check for valid factory class
			if (!TypeInfoFactory.class.isAssignableFrom(factoryClass)) {
				throw new InvalidTypesException("TypeInfo annotation does not specify a valid TypeInfoFactory.");
			}
		}

		// instantiate
		return (TypeInfoFactory<OUT>) InstantiationUtil.instantiate(factoryClass);
	}
1215474
@Nullable
    public <T> Provider<T> getScopedFactory(Class scope, Class<T> classDefinition) {
        //noinspection unchecked
        return factories.getScope(scope).get(classDefinition);
    }
428011
private static <T> ServiceBindingBuilder<T> newFactoryBinder(final Factory<T> factory) {
        return BindingBuilderFactory.newFactoryBinder(factory);
    }
759968
private MutableSecondaryTypeDefinition getSecondaryTypeDefinition(final String typeId, final boolean includePropertyDefinitions, final boolean baseType) {

		final TypeDefinitionFactory factory      = TypeDefinitionFactory.newInstance();
		final MutableSecondaryTypeDefinition def = factory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1, baseType ? null : BaseTypeId.CMIS_SECONDARY.value());

		def.setIsCreatable(false);

		initializeExtendedType(def, typeId);

		if (!includePropertyDefinitions) {
			def.removeAllPropertyDefinitions();
		}

		return def;
	}
1186860
def of(self, klass, name="default"):
        
        return FactoryBuilder(
            klass, name, self._definitions, self._faker, self._resolver
        )
58836
public @Nonnull
    ClassDescriptor getClassDescriptor(@SlashedClassName String className) {
        assert className.indexOf('.') == -1;
        ClassDescriptor classDescriptor = classDescriptorMap.get(className);
        if (classDescriptor == null) {
            if (MODULE_INFO.getClassName().equals(className)) {
                // don't allow module info to be added to the map,
                // which could be used to check referenced classes
                return MODULE_INFO;
            }
            classDescriptor = new ClassDescriptor(className);
            classDescriptorMap.put(className, classDescriptor);
        }
        return classDescriptor;
    }
794371
public <T> T getOnce(final Class<T> clazz, final String name)
	{
		return new JAXBNamedResourceFactory<T>(this.config, this.factory, name, clazz).get();
	}
457259
public static <T> Instantiator<T> of(Class<T> type) {
        if (Modifier.isAbstract(type.getModifiers())) {
            return new Instantiator<>(giveDynamicSubclass(type));
        }
        return new Instantiator<>(type);
    }
1317312
public <E> ClassFactory<E> createFactory(String... classes) {
    try {
      return new ClassFactory<E>(classname, classes);
    } catch (ClassCreationException e){
      throw e;
    } catch (Exception e) {
      throw new ClassCreationException(e);
    }
  }
129946
public FacesConfigFactoryType<FacesConfigType<T>> getOrCreateFactory()
   {
      List<Node> nodeList = childNode.get("factory");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FacesConfigFactoryTypeImpl<FacesConfigType<T>>(this, "factory", childNode, nodeList.get(0));
      }
      return createFactory();
   }
40966
@SuppressWarnings("unchecked")
    public static <T> T instantiate(final Class<T> tClass) {
        try {
            if(tClass == null)
                return null;

            final Constructor<?> zeroArgConstructor = Arrays.stream(tClass.getDeclaredConstructors())
                    .filter(c -> c.getParameterCount() == 0)
                    .findFirst().orElse(null);

            if(zeroArgConstructor == null) {
                logger.warning("[CAN NOT INSTANTIATE] : " + tClass + ", have NO zero arg constructor.");
                return null;
            }

            return ((T) zeroArgConstructor.newInstance());
        } catch (InstantiationException | InvocationTargetException e) {
            logger.warning("[CAN NOT INSTANTIATE] : " + tClass
                    + " - class may be an abstract class, an interface, "
                    + "array, primitive." + e.getMessage());
        } catch (IllegalAccessException e) {
            logger.warning("[CAN NOT INSTANTIATE] : " + tClass
                    + " - no access to instantiating object." + e.getMessage());
        }
        return null;
    }
344432
@SuppressWarnings("unchecked")
    public <T> CellConverterFactory<T> getConverterFactory(final Class<T> clazz) {
        ArgUtils.notNull(clazz, "clazz");
        
        CellConverterFactory<T> converterFactory = (CellConverterFactory<T>) converterFactoryMap.get(clazz);
        if(converterFactory == null) {
            // 特別に判定が必要なクラス
            if(Enum.class.isAssignableFrom(clazz)) {
                converterFactory = (CellConverterFactory<T>) converterFactoryMap.get(Enum.class);
                
            } else if(List.class.isAssignableFrom(clazz)) {
                converterFactory = (CellConverterFactory<T>) converterFactoryMap.get(List.class);
                
            } else if(clazz.isArray()) {
                converterFactory = (CellConverterFactory<T>) converterFactoryMap.get(Object[].class);
                
            }
        }
        
        return converterFactory;
    }
258899
public ImmutableList<Constructor> getConstructors(Class classDefinition) {
        if (definedClasses.getRootValue().containsKey(classDefinition)) {
            return definedClasses.getRootValue().get(classDefinition);
        }
        return new ImmutableArrayList<>();
    }
1285338
@SuppressWarnings("unchecked")
    public static <T> IDomainFactory<T> getFactory(Class<T> clazz) {
        for (IDomainFactory<?> factory : instance) {
            String alias = factory.getAlias(clazz);
            
            if (alias != null) {
                return (IDomainFactory<T>) factory;
            }
        }
        
        throw new IllegalArgumentException("Domain class has no registered factory: " + clazz.getName());
    }
18508
protected final HylaFAXClientConnectionFactory createHylaFAXClientConnectionFactory(String className)
    {
        //create new instance
        HylaFAXClientConnectionFactory factory=(HylaFAXClientConnectionFactory)ReflectionHelper.createInstance(className);
            
        //initialize
        factory.initialize(this);
        
        return factory;
    }
756192
public static Object instantiate(String type, ClassLoader classLoader) {
        try {
            return ClassUtils.forName(type, classLoader)
                .flatMap(InstantiationUtils::tryInstantiate)
                .orElseThrow(() -> new InstantiationException("No class found for name: " + type));
        } catch (Throwable e) {
            throw new InstantiationException("Could not instantiate type [" + type + "]: " + e.getMessage(), e);
        }
    }