org.apache.openjpa.meta
Class FetchGroup

java.lang.Object
  extended by org.apache.openjpa.meta.FetchGroup
All Implemented Interfaces:
Serializable

public class FetchGroup
extends Object
implements Serializable

Captures fetch group metadata.

See Also:
Serialized Form

Field Summary
(package private) static FetchGroup ALL
          Standard "all" fetch group.
(package private) static FetchGroup DEFAULT
          Standard default fetch group.
static int DEPTH_INFINITE
          Infinite depth.
static String NAME_ALL
          Name of the "all" fetch group.
static String NAME_DEFAULT
          Name of the default fetch group.
static int RECURSION_DEPTH_DEFAULT
          Default field recursion depth.
 
Constructor Summary
FetchGroup(ClassMetaData cm, String name)
          Constructor; supply immutable name.
 
Method Summary
 boolean addContainedBy(FetchGroup parent)
          Adds this receiver as one of the included fetch groups of the given parent.
 void addDeclaredInclude(String fgName)
          Includes given fetch group within this receiver.
(package private)  void copy(FetchGroup fg)
          Copy state from the given fetch group.
 boolean equals(Object other)
          Affirms equality if the other has the same name and declaring type.
 Set getContainedBy()
          Gets the name of the fetch groups in which this receiver has been included.
 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.
 String getName()
          Fetch group name.
 int getRecursionDepth(FieldMetaData fm)
          Recursion depth for the given field.
 int hashCode()
           
 boolean includes(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 metadata.
 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_DEFAULT

public static final String NAME_DEFAULT
Name of the default fetch group.

See Also:
Constant Field Values

NAME_ALL

public static final 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

DEPTH_INFINITE

public static final int DEPTH_INFINITE
Infinite depth.

See Also:
Constant Field Values

DEFAULT

static final FetchGroup DEFAULT
Standard default fetch group.


ALL

static final FetchGroup ALL
Standard "all" fetch group.

Constructor Detail

FetchGroup

FetchGroup(ClassMetaData cm,
           String name)
Constructor; supply immutable name.

Parameters:
name - must not by null or empty.
Method Detail

copy

void copy(FetchGroup fg)
Copy state from the given fetch group.


getName

public String getName()
Fetch group name.


addDeclaredInclude

public void addDeclaredInclude(String fgName)
Includes given fetch group within this receiver.


includes

public boolean includes(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 fecth 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 Set 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 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 metadata.


equals

public boolean equals(Object other)
Affirms equality if the other has the same name and declaring type.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.