Package io.kojan.xml

Class Relationship<EnclosingType,​EnclosingBean,​RelatedType,​RelatedBean>

  • Type Parameters:
    EnclosingType - data type of entity
    EnclosingBean - type of bean associated with the entity
    RelatedType - data type of related entity
    RelatedBean - type of bean of related entity

    public class Relationship<EnclosingType,​EnclosingBean,​RelatedType,​RelatedBean>
    extends Property<EnclosingType,​EnclosingBean,​RelatedType>
    Relationship of one Entity type to another. A complex Property with no simple text representation.

    When stored in XML form, a relationship is represented by zero or more XML subtrees describing each of related entity instances.

    Author:
    Mikolaj Izdebski
    • Method Detail

      • of

        public static <Type,​Bean,​RelatedType,​RelatedBean> Relationship<Type,​Bean,​RelatedType,​RelatedBean> of​(Entity<RelatedType,​RelatedBean> relatedEntity,
                                                                                                                                                 Getter<Type,​java.lang.Iterable<RelatedType>> getter,
                                                                                                                                                 Setter<Bean,​RelatedType> setter)
        Creates a non-unique, optional relationship with another entity.
        Type Parameters:
        Type - data type of relating entity
        Bean - type of bean associated with the relating entity
        RelatedType - data type of related entity
        RelatedBean - type of bean of related entity
        Parameters:
        relatedEntity - related entity
        getter - entity bean getter method that returns value of the related entity
        setter - entity bean setter method that returns value of the related entity
        Returns:
        created relationship
      • ofSingular

        public static <Type,​Bean,​RelatedType,​RelatedBean> Relationship<Type,​Bean,​RelatedType,​RelatedBean> ofSingular​(Entity<RelatedType,​RelatedBean> relatedEntity,
                                                                                                                                                         Getter<Type,​RelatedType> getter,
                                                                                                                                                         Setter<Bean,​RelatedType> setter)
        Creates a unique, optional relationship with another entity.
        Type Parameters:
        Type - data type of relating entity
        Bean - type of bean associated with the relating entity
        RelatedType - data type of related entity
        RelatedBean - type of bean of related entity
        Parameters:
        relatedEntity - related entity
        getter - entity bean getter method that returns value of the related entity
        setter - entity bean setter method that returns value of the related entity
        Returns:
        created relationship