Class FetchGroupManager

java.lang.Object
org.datanucleus.FetchGroupManager

public class FetchGroupManager extends 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 Details

    • fetchGroupByName

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

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

    • FetchGroupManager

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

    • 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(Class<T> cls, 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(Class<T> cls, 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 Set<FetchGroup> getFetchGroupsWithName(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.