Skip to content
Michael Guymon edited this page Nov 1, 2013 · 10 revisions

A Policy is a cross cutting rule applied to the ModelFactory. They apply to an individual Field in a Blueprint as a FieldPolicy or to the Blueprint as a whole as a BlueprintPolicy.

For example, the FieldPolicy MappedSingletonPolicy . This allows a @Mapped Field to be treated as a singleton and be reused for multiple model creations. See the JUnit test MappedSingletonPolicyTest where a single Driver is the owner of multiple Cars.

Adding a Policy to the ModelFactory


ModelFactory modelFactory = new ModelFactory();
modelFactory.addPolicy( new MappedSingletonPolicy( Driver.class ) );

Clone this wiki locally