Module aeonics.core

Class Relationship

  • All Implemented Interfaces:
    Documented, Exportable

    public class Relationship
    extends java.lang.Object
    implements Documented
    This class defines the type of relationship an Entity may have with other entities. It is used by the corresponding Template to create and populate new instances of the entity.
    • Constructor Summary

      Constructors 
      Constructor Description
      Relationship​(java.lang.String name)
      Create a new relationship
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <R extends Relationship>
      R
      add​(Parameter parameter)
      Adds a parameter linked to this relationship
      java.lang.String category()
      Returns the target entity category to relate to
      <R extends Relationship>
      R
      category​(java.lang.Class<? extends Item<? extends Entity>> value)
      Sets the target entity category to relate to
      <R extends Relationship>
      R
      category​(java.lang.String value)
      Sets the target entity category to relate to
      java.lang.String description()
      Returns the relationship description
      <R extends Relationship>
      R
      description​(java.lang.String value)
      Sets the relationship description
      Data export()
      Renders this class instance to a simple data structure for rendering client-side.
      int max()
      Returns the maximum number of relations.
      <R extends Relationship>
      R
      max​(int value)
      Sets the maximum number of relations.
      int min()
      Returns the minimum number of relations
      <R extends Relationship>
      R
      min​(int value)
      Sets the minimum number of relations
      java.lang.String name()
      Returns the relationship name
      boolean ordered()
      Returns whether or not the order of multiple values should be perserved
      <R extends Relationship>
      R
      ordered​(boolean value)
      Sets whether or not the order of multiple values should be perserved
      java.util.Map<java.lang.String,​Parameter> parameters()
      Returns the list of parameters for this relationship
      java.lang.String summary()
      Returns the relationship summary
      <R extends Relationship>
      R
      summary​(java.lang.String value)
      Sets the relationship summary
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Relationship

        public Relationship​(java.lang.String name)
        Create a new relationship
        Parameters:
        name - the relationship name
        Throws:
        java.lang.IllegalArgumentException - if the name is null or blank
    • Method Detail

      • name

        public java.lang.String name()
        Returns the relationship name
        Specified by:
        name in interface Documented
        Returns:
        the relationship name
      • summary

        public java.lang.String summary()
        Returns the relationship summary
        Specified by:
        summary in interface Documented
        Returns:
        the relationship summary
      • summary

        public <R extends Relationship> R summary​(java.lang.String value)
        Sets the relationship summary
        Type Parameters:
        R - the relationship type
        Parameters:
        value - the summary
        Returns:
        this
      • description

        public java.lang.String description()
        Returns the relationship description
        Specified by:
        description in interface Documented
        Returns:
        the relationship description
      • description

        public <R extends Relationship> R description​(java.lang.String value)
        Sets the relationship description
        Type Parameters:
        R - the relationship type
        Parameters:
        value - the description
        Returns:
        this
      • category

        public java.lang.String category()
        Returns the target entity category to relate to
        Returns:
        the target entity type to relate to
      • category

        public <R extends Relationship> R category​(java.lang.Class<? extends Item<? extends Entity>> value)
        Sets the target entity category to relate to
        Type Parameters:
        R - the relationship type
        Parameters:
        value - the target entity category to relate to
        Returns:
        this
      • category

        public <R extends Relationship> R category​(java.lang.String value)
        Sets the target entity category to relate to
        Type Parameters:
        R - the relationship type
        Parameters:
        value - the target entity category to relate to
        Returns:
        this
      • min

        public int min()
        Returns the minimum number of relations
        Returns:
        the minimum number of relations
      • min

        public <R extends Relationship> R min​(int value)
        Sets the minimum number of relations
        Type Parameters:
        R - the relationship type
        Parameters:
        value - the minimum number of relations
        Returns:
        this
      • max

        public int max()
        Returns the maximum number of relations. If negative, it means that the maximum is not set.
        Returns:
        the maximum number of relations
      • max

        public <R extends Relationship> R max​(int value)
        Sets the maximum number of relations.
        Type Parameters:
        R - the relationship type
        Parameters:
        value - the maximum number of relations (-1 if undefined)
        Returns:
        this
      • ordered

        public boolean ordered()
        Returns whether or not the order of multiple values should be perserved
        Returns:
        whether or not the order of multiple values should be perserved
      • ordered

        public <R extends Relationship> R ordered​(boolean value)
        Sets whether or not the order of multiple values should be perserved
        Type Parameters:
        R - the relationship type
        Parameters:
        value - whether or not the order of multiple values should be perserved
        Returns:
        this
      • parameters

        public java.util.Map<java.lang.String,​Parameter> parameters()
        Returns the list of parameters for this relationship
        Returns:
        the list of parameters for this relationship
      • add

        public <R extends Relationship> R add​(Parameter parameter)
        Adds a parameter linked to this relationship
        Type Parameters:
        R - the relationship type
        Parameters:
        parameter - the parameter definition
        Returns:
        this
      • export

        public Data export()
        Description copied from interface: Exportable
        Renders this class instance to a simple data structure for rendering client-side.
        Specified by:
        export in interface Documented
        Specified by:
        export in interface Exportable
        Returns:
        a public data representation of this class instance