public class MappedSingletonPolicy extends Object implements FieldPolicy
Policy
for creating models.
If constructed with a Class, the first attempt to set @Mapped instance of Class
will use ModelFactory#createModel(Class, false) to create singleton to use
for all instances of Class in registered Blueprints. Note:
the ModelFactory#createModel(Class,false) will not run any Policy
for the creation.
If constructed with a Model, the Model will be used for all @Mapped instances of
Model's class in registered Blueprints.| Constructor and Description |
|---|
MappedSingletonPolicy(Class singletonClass)
Create new Singleton with from a registered Class.
|
MappedSingletonPolicy(Object model)
Create new instance with Model.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getSingleton() |
Class |
getTarget()
Class target of the Policy that has been mapped by a
Blueprint |
Command |
process(ModelFactory modelFactory,
Erector erector,
ModelField modelField,
Object model)
Process the model with the Policy.
|
void |
setSingleton(Object singleton) |
public MappedSingletonPolicy(Class singletonClass)
modelClass - Classpublic MappedSingletonPolicy(Object model)
model - Objectpublic Object getSingleton()
public void setSingleton(Object singleton)
public Command process(ModelFactory modelFactory, Erector erector, ModelField modelField, Object model) throws PolicyException
FieldPolicyprocess in interface FieldPolicymodelFactory - ModelFactoryerector - ErectormodelField - ModelFieldmodel - ObjectPolicyExceptionCopyright © 2012. All Rights Reserved.