org.datanucleus
Class FetchGroup

java.lang.Object
  extended by org.datanucleus.FetchGroup
All Implemented Interfaces:
java.io.Serializable

public class FetchGroup
extends java.lang.Object
implements java.io.Serializable

Group of fields for fetching, to be part of a FetchPlan. Defined at runtime, via the API.

See Also:
Serialized Form

Field Summary
static java.lang.String ALL
           
static java.lang.String BASIC
           
static java.lang.String DEFAULT
           
protected static Localiser LOCALISER
          Localisation utility for output messages
static java.lang.String MULTIVALUED
           
static java.lang.String RELATIONSHIP
           
 
Constructor Summary
FetchGroup(FetchGroup grp)
          Constructor to take a copy of the supplied group, but modifiable.
FetchGroup(OMFContext omfCtx, java.lang.String name, java.lang.Class cls)
          Constructor.
 
Method Summary
 FetchGroup addCategory(java.lang.String categoryName)
          Convenience method to add the members for the specified category.
 FetchGroup addMember(java.lang.String memberName)
          Method to add a field of the class to the fetch group.
 FetchGroup addMembers(java.lang.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.
 java.util.Set<java.lang.String> getMembers()
          Accessor for the members that are in this fetch group.
 java.lang.String getName()
          Accessor for the group name.
 boolean getPostLoad()
          Accessor for whether to call postLoad when this group is loaded.
 int getRecursionDepth(java.lang.String memberName)
          Accessor for the recursion depth for the specified field/property.
 java.lang.Class 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(java.lang.String categoryName)
          Convenience method to remove the members for the specified category.
 FetchGroup removeMember(java.lang.String memberName)
          Method to remove a field of the class from the fetch group.
 FetchGroup removeMembers(java.lang.String[] members)
           
 void setPostLoad(boolean postLoad)
          Mutator for whether the postLoad callback should be called on loading this fetch group.
 FetchGroup setRecursionDepth(java.lang.String memberName, int recursionDepth)
          Method to set the recursion depth for the specified field/property.
 FetchGroup setUnmodifiable()
          Method to make the group unmodifiable.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localisation utility for output messages


DEFAULT

public static final java.lang.String DEFAULT
See Also:
Constant Field Values

RELATIONSHIP

public static final java.lang.String RELATIONSHIP
See Also:
Constant Field Values

MULTIVALUED

public static final java.lang.String MULTIVALUED
See Also:
Constant Field Values

BASIC

public static final java.lang.String BASIC
See Also:
Constant Field Values

ALL

public static final java.lang.String ALL
See Also:
Constant Field Values
Constructor Detail

FetchGroup

public FetchGroup(OMFContext omfCtx,
                  java.lang.String name,
                  java.lang.Class cls)
Constructor.

Parameters:
omfCtx - OMF Context
name - Name of the group
cls - The class

FetchGroup

public FetchGroup(FetchGroup grp)
Constructor to take a copy of the supplied group, but modifiable.

Parameters:
grp - The existing group
Method Detail

getName

public java.lang.String getName()
Accessor for the group name.

Returns:
Name of the group

getType

public java.lang.Class getType()
Accessor for the class that this group is for.

Returns:
the class

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(java.lang.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(java.lang.String memberName,
                                    int recursionDepth)
Method to set the recursion depth for the specified field/property.

Parameters:
memberName - Name of field/property
recursionDepth - 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(java.lang.String categoryName)
Convenience method to add the members for the specified category. Supports the categories defined in the JDO2.2 spec.

Parameters:
categoryName - Name of the category
Returns:
This group

removeCategory

public FetchGroup removeCategory(java.lang.String categoryName)
Convenience method to remove the members for the specified category. Supports the categories defined in the JDO2.2 spec.

Parameters:
categoryName - Name of the category
Returns:
This group

getMembers

public java.util.Set<java.lang.String> getMembers()
Accessor for the members that are in this fetch group.

Returns:
Set of member names.

addMember

public FetchGroup addMember(java.lang.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(java.lang.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(java.lang.String[] members)

removeMembers

public FetchGroup removeMembers(java.lang.String[] members)

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.


hashCode

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

toString

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


Copyright © 2010. All Rights Reserved.