T
- The type of the instances being served by the factory.TypeFactory<T>
, org.refcodes.mixin.TypeAccessor<T>
public class ClassTypeFactory<T> extends Object implements TypeFactory<T>
ClassTypeFactory
produces instances of the given Class
by
invoking the empty constructor. Make sure your provided Class
has an
empty constructor.org.refcodes.mixin.TypeAccessor.TypeBuilder<T extends Object,B extends org.refcodes.mixin.TypeAccessor.TypeBuilder<T,B>>, org.refcodes.mixin.TypeAccessor.TypeMutator<T extends Object>, org.refcodes.mixin.TypeAccessor.TypeProperty<T extends Object>
Constructor | Description |
---|---|
ClassTypeFactory(Class<T> aClass) |
Constructs a
ClassTypeFactory for the given Class . |
Modifier and Type | Method | Description |
---|---|---|
T |
createInstance() |
This method creates / retrieves an instance of the given type with the
given identifier (name) constructed as defined in one to many
configuration files.
|
Class<T> |
getType() |
This method retrieves the type which the implementing factory produces.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createInstance
public ClassTypeFactory(Class<T> aClass)
ClassTypeFactory
for the given Class
.aClass
- The Class
for which to produce instances.public T createInstance()
createInstance
in interface TypeFactory<T>
public Class<T> getType()
TypeFactory.createInstance()
's
Object.getClass()
(as we cannot get a generic type's class if not
explicitly passed to an instance e.g. through it's constructor).
Attention: To avoid unnecessary calls to potentially expensive
TypeFactory.createInstance()
methods, please overwrite this method.getType
in interface org.refcodes.mixin.TypeAccessor<T>
getType
in interface TypeFactory<T>
Copyright © 2021. All rights reserved.