org.qi4j.library.conversion.values
Interface EntityToValueService

All Superinterfaces:
Composite, EntityToValue, Identity, ServiceComposite

public interface EntityToValueService
extends EntityToValue, ServiceComposite

The EntityToValueService converts Entities to matching Values.

The main purpose of this service is to provide convenience to map entities to serializable values, for instance to be transported across a network. The ValueComposite to convert the Entity to must closely match the Entity for this mapping to work. The rules are fairly straight forward;

  1. Any Property in the EntityComposite to be mapped, must (by default) exist in the ValueComposite with the same fully qualified name, i.e. method declared in the same interface. If the ValueComposite is annotated with @Unqualified then the Property method look up will only locate the properties with the name only, i.e. the methods may defined in different interfaces.
  2. For any Association in the EntityComposite, a Property<String> with the same unqualified name will be looked up in the ValueComposite. If found, the EntityReference of the Association will be converted to an URI and written to the String property.
  3. For any ManyAssociation in the EntityComposite, a Property<List<String>> with the same unqualified name will be looked up in the ValueComposite. If found, the EntityReferences in the ManyAssociation will be converted to URIs and placed into a List and set to the Property in ValueComposite.

If a Property from the Entity is not found in the Value, then it is ignored.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.qi4j.library.conversion.values.EntityToValue
EntityToValue.EntityToValueMixin
 
Nested classes/interfaces inherited from interface org.qi4j.api.entity.Identity
Identity.IdentityMixin
 
Method Summary
 
Methods inherited from interface org.qi4j.library.conversion.values.EntityToValue
convert
 
Methods inherited from interface org.qi4j.api.entity.Identity
identity
 
Methods inherited from interface org.qi4j.api.composite.Composite
metaInfo, type