Class FetchGroup

  • All Implemented Interfaces:
    java.io.Serializable

    public class FetchGroup
    extends java.lang.Object
    implements java.io.Serializable
    Captures fetch group meta-data. Fetch Group is identified and referred by its immutable name. Fetch Group can nest other groups. The nested group reference is the name of the nested group. Defines two standard fetch group named default and all.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEPTH_INFINITE
      Infinite depth.
      static java.lang.String NAME_ALL
      Name of the "all" fetch group.
      static java.lang.String NAME_DEFAULT
      Name of the default fetch group.
      static int RECURSION_DEPTH_DEFAULT
      Default field recursion depth.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addContainedBy​(FetchGroup parent)
      Adds this receiver as one of the included fetch groups of the given parent.
      void addDeclaredInclude​(java.lang.String fgName)
      Includes given fetch group within this receiver.
      boolean equals​(java.lang.Object other)
      Affirms equality if the other has the same name and declaring type.
      java.util.Set<java.lang.String> getContainedBy()
      Gets the name of the fetch groups in which this receiver has been included.
      java.lang.String[] getDeclaredIncludes()
      Return the fetch group names declared included by this group.
      int getDeclaredRecursionDepth​(FieldMetaData fm)
      Return the recursion depth declared for the given field, or 0 if none.
      FieldMetaData[] getDeclaredRecursionDepthFields()
      Return the fields with declared recursion depths in this group.
      java.lang.String getName()
      Fetch group name.
      int getRecursionDepth​(FieldMetaData fm)
      Recursion depth for the given field.
      int hashCode()  
      boolean includes​(java.lang.String fgName, boolean recurse)
      Affirms if given fetch group is included by this receiver.
      boolean isPostLoad()
      Whether loading this fetch group causes a post-load callback on the loaded instance.
      boolean isPostLoadExplicit()
      Whether the post-load value is declared for this group.
      void resolve()
      Resolve and validate fetch group meta-data.
      void setPostLoad​(boolean flag)
      Whether loading this fetch group causes a post-load callback on the loaded instance.
      void setRecursionDepth​(FieldMetaData fm, int depth)
      Recursion depth for the given field.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NAME_DEFAULT

        public static final java.lang.String NAME_DEFAULT
        Name of the default fetch group.
        See Also:
        Constant Field Values
      • NAME_ALL

        public static final java.lang.String NAME_ALL
        Name of the "all" fetch group.
        See Also:
        Constant Field Values
      • RECURSION_DEPTH_DEFAULT

        public static final int RECURSION_DEPTH_DEFAULT
        Default field recursion depth.
        See Also:
        Constant Field Values
    • Method Detail

      • getName

        public java.lang.String getName()
        Fetch group name.
      • addDeclaredInclude

        public void addDeclaredInclude​(java.lang.String fgName)
        Includes given fetch group within this receiver.
      • includes

        public boolean includes​(java.lang.String fgName,
                                boolean recurse)
        Affirms if given fetch group is included by this receiver. Includes superclass definition of fetch group and optionally other included groups.
        Parameters:
        recurse - if true then recursively checks within the included fecth groups
      • addContainedBy

        public boolean addContainedBy​(FetchGroup parent)
        Adds this receiver as one of the included fetch groups of the given parent. The parent fetch group will include this receiver as a side-effect of this call.
        Returns:
        true if given parent is a new addition. false othrwise.
        Since:
        1.1.0
        See Also:
        includes(String, boolean), addDeclaredInclude(String)
      • getContainedBy

        public java.util.Set<java.lang.String> getContainedBy()
        Gets the name of the fetch groups in which this receiver has been included.
        Since:
        1.1.0
        See Also:
        addContainedBy(FetchGroup)
      • getDeclaredIncludes

        public java.lang.String[] getDeclaredIncludes()
        Return the fetch group names declared included by this group.
      • setRecursionDepth

        public void setRecursionDepth​(FieldMetaData fm,
                                      int depth)
        Recursion depth for the given field. This is the depth of relations of the same class as this one we can fetch through the given field.
      • getRecursionDepth

        public int getRecursionDepth​(FieldMetaData fm)
        Recursion depth for the given field. This is the depth of relations of the same class as this one we can fetch through the given field.
      • getDeclaredRecursionDepth

        public int getDeclaredRecursionDepth​(FieldMetaData fm)
        Return the recursion depth declared for the given field, or 0 if none.
      • getDeclaredRecursionDepthFields

        public FieldMetaData[] getDeclaredRecursionDepthFields()
        Return the fields with declared recursion depths in this group.
      • setPostLoad

        public void setPostLoad​(boolean flag)
        Whether loading this fetch group causes a post-load callback on the loaded instance.
      • isPostLoad

        public boolean isPostLoad()
        Whether loading this fetch group causes a post-load callback on the loaded instance.
      • isPostLoadExplicit

        public boolean isPostLoadExplicit()
        Whether the post-load value is declared for this group.
      • resolve

        public void resolve()
        Resolve and validate fetch group meta-data.
      • equals

        public boolean equals​(java.lang.Object other)
        Affirms equality if the other has the same name and declaring type.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object