Package org.datanucleus
Class FetchGroup<T>
- java.lang.Object
-
- org.datanucleus.FetchGroup<T>
-
- Type Parameters:
T
- Class that this FetchGroup is for
- All Implemented Interfaces:
Serializable
public class FetchGroup<T> extends Object implements Serializable
Group of fields for fetching, to be used by a FetchPlan. Defined at runtime, via the API (aka dynamic fetch group). Shared by FetchPlan's, so can be used by multiple threads.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALL
static String
BASIC
static String
DEFAULT
static String
MULTIVALUED
static String
RELATIONSHIP
-
Constructor Summary
Constructors Constructor Description FetchGroup(FetchGroup<T> grp)
Constructor to take a copy of the supplied group, but modifiable.FetchGroup(NucleusContext nucleusCtx, String name, Class<T> cls)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FetchGroup
addCategory(String categoryName)
Convenience method to add the members for the specified category.FetchGroup
addMember(String memberName)
Method to add a field of the class to the fetch group.FetchGroup
addMembers(String[] members)
void
deregisterListener(FetchPlan plan)
Method to deregister a listener for changes to this FetchGroup.void
disconnectFromListeners()
Method to disconnect this fetch group from all listeners since the group is removed from use.boolean
equals(Object obj)
Collection<FetchPlan>
getListenerFPs()
Set<String>
getMembers()
Accessor for the members that are in this fetch group.String
getName()
Accessor for the group name.boolean
getPostLoad()
Accessor for whether to call postLoad when this group is loaded.int
getRecursionDepth(String memberName)
Accessor for the recursion depth for the specified field/property.Class<T>
getType()
Accessor for the class that this group is for.int
hashCode()
boolean
isUnmodifiable()
Accessor for modifiability status of this group.void
registerListener(FetchPlan plan)
Method to register a listener for changes to this FetchGroup.FetchGroup
removeCategory(String categoryName)
Convenience method to remove the members for the specified category.FetchGroup
removeMember(String memberName)
Method to remove a field of the class from the fetch group.FetchGroup
removeMembers(String[] members)
void
setPostLoad(boolean postLoad)
Mutator for whether the postLoad callback should be called on loading this fetch group.FetchGroup
setRecursionDepth(String memberName, int recursionDepth)
Method to set the recursion depth for the specified field/property.FetchGroup
setUnmodifiable()
Method to make the group unmodifiable.String
toString()
-
-
-
Field Detail
-
DEFAULT
public static final String DEFAULT
- See Also:
- Constant Field Values
-
RELATIONSHIP
public static final String RELATIONSHIP
- See Also:
- Constant Field Values
-
MULTIVALUED
public static final String MULTIVALUED
- See Also:
- Constant Field Values
-
BASIC
public static final String BASIC
- See Also:
- Constant Field Values
-
ALL
public static final String ALL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FetchGroup
public FetchGroup(NucleusContext nucleusCtx, String name, Class<T> cls)
Constructor.- Parameters:
nucleusCtx
- Contextname
- Name of the groupcls
- The class
-
FetchGroup
public FetchGroup(FetchGroup<T> grp)
Constructor to take a copy of the supplied group, but modifiable.- Parameters:
grp
- The existing group
-
-
Method Detail
-
getName
public String getName()
Accessor for the group name.- Returns:
- Name of the group
-
setPostLoad
public void setPostLoad(boolean postLoad)
Mutator for whether the postLoad callback should be called on loading this fetch group.- Parameters:
postLoad
- Whether the postLoad callback should be called.
-
getPostLoad
public boolean getPostLoad()
Accessor for whether to call postLoad when this group is loaded.- Returns:
- Whether to call postLoad
-
getRecursionDepth
public int getRecursionDepth(String memberName)
Accessor for the recursion depth for the specified field/property.- Parameters:
memberName
- Name of field/property- Returns:
- The recursion depth
-
setRecursionDepth
public FetchGroup setRecursionDepth(String memberName, int recursionDepth)
Method to set the recursion depth for the specified field/property.- Parameters:
memberName
- Name of field/propertyrecursionDepth
- Recursion depth- Returns:
- The fetch group
-
setUnmodifiable
public FetchGroup setUnmodifiable()
Method to make the group unmodifiable. Once unmodifiable it cannot be made modifiable again.- Returns:
- This group
-
isUnmodifiable
public boolean isUnmodifiable()
Accessor for modifiability status of this group.- Returns:
- Whether it is no longer modifiable
-
addCategory
public FetchGroup addCategory(String categoryName)
Convenience method to add the members for the specified category. Supports the categories defined in the JDO spec.- Parameters:
categoryName
- Name of the category- Returns:
- This group
-
removeCategory
public FetchGroup removeCategory(String categoryName)
Convenience method to remove the members for the specified category. Supports the categories defined in the JDO spec.- Parameters:
categoryName
- Name of the category- Returns:
- This group
-
getMembers
public Set<String> getMembers()
Accessor for the members that are in this fetch group.- Returns:
- Set of member names.
-
addMember
public FetchGroup addMember(String memberName)
Method to add a field of the class to the fetch group.- Parameters:
memberName
- Name of the field/property- Returns:
- This FetchGroup
- Throws:
NucleusUserException
- if the field/property doesn't exist for this class
-
removeMember
public FetchGroup removeMember(String memberName)
Method to remove a field of the class from the fetch group.- Parameters:
memberName
- Name of the field/property- Returns:
- This FetchGroup
- Throws:
NucleusUserException
- if the field/property doesn't exist for this class
-
addMembers
public FetchGroup addMembers(String[] members)
-
removeMembers
public FetchGroup removeMembers(String[] members)
-
getListenerFPs
public Collection<FetchPlan> getListenerFPs()
-
registerListener
public void registerListener(FetchPlan plan)
Method to register a listener for changes to this FetchGroup.- Parameters:
plan
- The FetchPlan that is listening
-
deregisterListener
public void deregisterListener(FetchPlan plan)
Method to deregister a listener for changes to this FetchGroup.- Parameters:
plan
- The FetchPlan that is no longer listening
-
disconnectFromListeners
public void disconnectFromListeners()
Method to disconnect this fetch group from all listeners since the group is removed from use.
-
-