...
Code Block |
---|
@SliceResource(MappingStrategy.ALL) public class YetAnotherModel { private String text; //this field will be mapped private Longlong number; //and this will be mapped, too @JcrProperty("jcr:title") private String title; } |
Processors
In above examples you could see that some basic types of fields are mapped, including String, boolean, long... A piece of code which is responsible for mapping a given filed type(s) is called processor. The Mapper is build for extensions which means that you can register a number of processors, each one responsible for a given type. The architecture of mapper is based on visitor pattern. While mapping a resource to an object, the Mapper goes through all fields which should be mapped and for each of these fields it iterates through all register processors checking which one is willing to map the field. If a processor is willing to map the field, it do the actual mapping, meaning it stores a value in this field.
There are a number of predefined processors which can be used out of the box. But you can also implement yours and add them to your Mapper. The predefined processors include:
DefaultFieldProcessor
BooleanFieldProcessor
ImageFieldProcessor
SliceResourceProcessor
SliceReferenceProcessor
Post processors
InitializableModel
...