Class FetchGroupManager


  • public class FetchGroupManager
    extends java.lang.Object
    Manager for dynamic fetch groups. Manages a set of fetch groups with each FetchGroup for a particular class with a name. This class is thread safe.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.util.Set<FetchGroup>> fetchGroupByName
      Map of dynamic fetch groups, keyed by the group name.
      private NucleusContext nucleusCtx
      Context that we are operating in.
    • Constructor Summary

      Constructors 
      Constructor Description
      FetchGroupManager​(NucleusContext ctx)
      Constructor for a FetchGroupManager for a particular Context.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFetchGroup​(FetchGroup grp)
      Method to add a dynamic fetch group.
      void clearFetchGroups()
      Clear out all fetch groups from use by this manager.
      <T> FetchGroup<T> createFetchGroup​(java.lang.Class<T> cls, java.lang.String name)
      Method to create a new FetchGroup for the class and name.
      <T> FetchGroup<T> getFetchGroup​(java.lang.Class<T> cls, java.lang.String name, boolean createIfNotPresent)
      Accessor for a fetch group for the specified class.
      java.util.Set<FetchGroup> getFetchGroupsWithName​(java.lang.String name)
      Accessor for the fetch groups for the specified name.
      void removeFetchGroup​(FetchGroup grp)
      Method to remove a dynamic FetchGroup from use.
      • Methods inherited from class java.lang.Object

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

      • fetchGroupByName

        private java.util.Map<java.lang.String,​java.util.Set<FetchGroup>> fetchGroupByName
        Map of dynamic fetch groups, keyed by the group name.
      • nucleusCtx

        private NucleusContext nucleusCtx
        Context that we are operating in.
    • Constructor Detail

      • FetchGroupManager

        public FetchGroupManager​(NucleusContext ctx)
        Constructor for a FetchGroupManager for a particular Context.
        Parameters:
        ctx - The Context
    • Method Detail

      • addFetchGroup

        public void addFetchGroup​(FetchGroup grp)
        Method to add a dynamic fetch group.
        Parameters:
        grp - The fetch group
      • removeFetchGroup

        public void removeFetchGroup​(FetchGroup grp)
        Method to remove a dynamic FetchGroup from use.
        Parameters:
        grp - The group
      • getFetchGroup

        public <T> FetchGroup<T> getFetchGroup​(java.lang.Class<T> cls,
                                               java.lang.String name,
                                               boolean createIfNotPresent)
        Accessor for a fetch group for the specified class. If the fetch group of this name for this class doesn't exist then will create one if the flag is set.
        Type Parameters:
        T - Type that the FetchGroup is for
        Parameters:
        cls - The class
        name - Name of the group
        createIfNotPresent - Whether this method should create+add a FetchGroup if on with this name isn't found.
        Returns:
        The FetchGroup
      • createFetchGroup

        public <T> FetchGroup<T> createFetchGroup​(java.lang.Class<T> cls,
                                                  java.lang.String name)
        Method to create a new FetchGroup for the class and name. Doesn't add it to the internally managed groups.
        Type Parameters:
        T - Type that the FetchGroup is for
        Parameters:
        cls - The class
        name - Name of the group
        Returns:
        The FetchGroup
      • getFetchGroupsWithName

        public java.util.Set<FetchGroup> getFetchGroupsWithName​(java.lang.String name)
        Accessor for the fetch groups for the specified name. Used by FetchPlan to find FetchGroups for a specific name.
        Parameters:
        name - Name of the group
        Returns:
        The FetchGroup
      • clearFetchGroups

        public void clearFetchGroups()
        Clear out all fetch groups from use by this manager.