EclipseLink 2.2.0, build 'v20110202-r8913' API Reference

org.eclipse.persistence.queries
Class AttributeGroup

java.lang.Object
  extended by org.eclipse.persistence.queries.AttributeGroup
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
CopyGroup, FetchGroup, LoadGroup

public class AttributeGroup
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Purpose: An AttributeGroup represents a set of mappings and nested AttributeGroups for relationship mappings for an entity type. Responsibilities:

To reference nested attributes a dot ('.') notation is used to reference related attributes. All attribute names provided are assumed to be correct until processed against the mappings during usage of the group.

See Also:
FetchGroup, LoadGroup, CopyGroup, Serialized Form
Author:
ailitchev
Since:
EclipseLink 2.1

Field Summary
protected  java.util.Map<java.lang.String,org.eclipse.persistence.internal.queries.AttributeItem> items
          Specified attributes in the group mapped to their AttributeItems
 
Constructor Summary
AttributeGroup()
           
AttributeGroup(java.lang.String name)
           
 
Method Summary
 void addAttribute(java.lang.String attributeNameOrPath)
          Add a basic attribute or nested attribute with each String representing an attribute on the path to what needs to be included in the AttributeGroup.
 void addAttribute(java.lang.String attributeNameOrPath, AttributeGroup group)
          Add a basic attribute or nested attribute with each String representing an attribute on the path to what needs to be included in the AttributeGroup.
 void addAttributes(java.util.Collection<java.lang.String> attrOrPaths)
          Add a set of attributes to the group.
 AttributeGroup clone()
           
 boolean containsAttribute(java.lang.String attributeNameOrPath)
          Return if the attribute is defined in the group.
protected  java.lang.String[] convert(java.lang.String... nameOrPath)
          Convert a provided name or path which could be a single attributeName, a single string with dot separated attribute names, or an array of attribute names defining the path.
 boolean equals(java.lang.Object obj)
           
 java.util.Set<java.lang.String> getAttributeNames()
           
 AttributeGroup getGroup(java.lang.String attributeNameOrPath)
          Returns AttributeGroup corresponding to the passed (possibly nested) attribute.
 org.eclipse.persistence.internal.queries.AttributeItem getItem(java.lang.String attributeNameOrPath)
          INTERNAL: Lookup the AttributeItemfor the provided attribute name or path.
 java.util.Map<java.lang.String,org.eclipse.persistence.internal.queries.AttributeItem> getItems()
          INTERNAL:
 java.lang.String getName()
           
 boolean hasItems()
          Indicates whether the group has at least one attribute.
 boolean isCopyGroup()
           
 boolean isFetchGroup()
           
 boolean isLoadGroup()
           
 boolean isSupersetOf(AttributeGroup anotherGroup)
          Return true if this AttributeGroup is a super-set of the passed in AttributeGroup.
protected  AttributeGroup newGroup(java.lang.String name, AttributeGroup parent)
          Subclass may create different types.
protected  org.eclipse.persistence.internal.queries.AttributeItem newItem(AttributeGroup group, java.lang.String attrName)
          Subclass may create different types.
 void removeAttribute(java.lang.String attributeNameOrPath)
          Remove an attribute from the group.
 void setAttributeNames(java.util.Set attributeNames)
           
 void setName(java.lang.String name)
           
 CopyGroup toCopyGroup()
           
 FetchGroup toFetchGroup()
           
 LoadGroup toLoadGroup()
           
 java.lang.String toString()
           
protected  java.lang.String toStringAdditionalInfo()
          Used by toString to print additional info for derived classes.
protected  java.lang.String toStringItems()
          Used by toString to print attribute items.
protected static java.lang.String toStringPath(java.lang.String[] attributePath, int position)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

items

protected java.util.Map<java.lang.String,org.eclipse.persistence.internal.queries.AttributeItem> items
Specified attributes in the group mapped to their AttributeItems

Constructor Detail

AttributeGroup

public AttributeGroup(java.lang.String name)

AttributeGroup

public AttributeGroup()
Method Detail

newItem

protected org.eclipse.persistence.internal.queries.AttributeItem newItem(AttributeGroup group,
                                                                         java.lang.String attrName)
Subclass may create different types.


newGroup

protected AttributeGroup newGroup(java.lang.String name,
                                  AttributeGroup parent)
Subclass may create different types.


getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getAttributeNames

public java.util.Set<java.lang.String> getAttributeNames()

setAttributeNames

public void setAttributeNames(java.util.Set attributeNames)

hasItems

public boolean hasItems()
Indicates whether the group has at least one attribute.


getItems

public java.util.Map<java.lang.String,org.eclipse.persistence.internal.queries.AttributeItem> getItems()
INTERNAL:


containsAttribute

public boolean containsAttribute(java.lang.String attributeNameOrPath)
Return if the attribute is defined in the group.


addAttribute

public void addAttribute(java.lang.String attributeNameOrPath)
Add a basic attribute or nested attribute with each String representing an attribute on the path to what needs to be included in the AttributeGroup.

Example: group.addAttribute("firstName");
group.addAttribute("manager.address");

Parameters:
attrPathOrName - A simple attribute, array or attributes forming a path

addAttribute

public void addAttribute(java.lang.String attributeNameOrPath,
                         AttributeGroup group)
Add a basic attribute or nested attribute with each String representing an attribute on the path to what needs to be included in the AttributeGroup.

Example: group.addAttribute("firstName", group1);
group.addAttribute("manager.address", group2);
Note that existing group corresponding to attributeNameOrPath will be overridden with the passed group.

Parameters:
attrPathOrName - A simple attribute, array or attributes forming a path
group - - an AttributeGroup to be added.

addAttributes

public void addAttributes(java.util.Collection<java.lang.String> attrOrPaths)
Add a set of attributes to the group.


getGroup

public AttributeGroup getGroup(java.lang.String attributeNameOrPath)
Returns AttributeGroup corresponding to the passed (possibly nested) attribute.


getItem

public org.eclipse.persistence.internal.queries.AttributeItem getItem(java.lang.String attributeNameOrPath)
INTERNAL: Lookup the AttributeItemfor the provided attribute name or path.

Returns:
item or null
Throws:
java.lang.IllegalArgumentException - if name is not valid attribute name or path

removeAttribute

public void removeAttribute(java.lang.String attributeNameOrPath)
Remove an attribute from the group.


isSupersetOf

public boolean isSupersetOf(AttributeGroup anotherGroup)
Return true if this AttributeGroup is a super-set of the passed in AttributeGroup.


convert

protected java.lang.String[] convert(java.lang.String... nameOrPath)
Convert a provided name or path which could be a single attributeName, a single string with dot separated attribute names, or an array of attribute names defining the path.

Throws:
java.lang.IllegalArgumentException - if name is not valid attribute name or path

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

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

toStringAdditionalInfo

protected java.lang.String toStringAdditionalInfo()
Used by toString to print additional info for derived classes.


toStringItems

protected java.lang.String toStringItems()
Used by toString to print attribute items.


toStringPath

protected static java.lang.String toStringPath(java.lang.String[] attributePath,
                                               int position)

isFetchGroup

public boolean isFetchGroup()

toFetchGroup

public FetchGroup toFetchGroup()

isCopyGroup

public boolean isCopyGroup()

toCopyGroup

public CopyGroup toCopyGroup()

isLoadGroup

public boolean isLoadGroup()

toLoadGroup

public LoadGroup toLoadGroup()

clone

public AttributeGroup clone()
Overrides:
clone in class java.lang.Object

EclipseLink 2.2.0, build 'v20110202-r8913' API Reference