Serializable
, TypeFactory<T>
, org.refcodes.mixin.TypeAccessor<T>
public class PrototypeFactory<T> extends Object implements TypeFactory<T>, Serializable
PrototypeFactory
creates instances of a specific type from a
prototype instance. Your type must implement either the Serializable
or the Cloneable
interface. Use Cloneable
for a shallow copy
by default, and Serializable
for a deep copy by default.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 |
---|---|
PrototypeFactory(T aPrototype) |
Constructs the factory with the according type.
|
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 PrototypeFactory(T aPrototype)
Serializable
or the Cloneable
interface. Use
Cloneable
for a shallow copy by default, and Serializable
for a deep copy by default.aPrototype
- The prototype to be used as prototype by this factory.public T createInstance()
createInstance
in interface TypeFactory<T>
public Class<T> getType()
TypeFactory
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.