org.eclipse.persistence.queries
Class AttributeGroup

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

public class AttributeGroup
extends Object
implements Serializable, 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.

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

Constructor Summary
AttributeGroup()
           
AttributeGroup(String name)
           
 
Method Summary
 void addAttribute(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(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(Collection<String> attrOrPaths)
          Add a set of attributes to the group.
 AttributeGroup clone()
           
 boolean containsAttribute(String attributeNameOrPath)
          Return if the attribute is defined in the group.
 boolean equals(Object obj)
           
 Set<String> getAttributeNames()
           
 AttributeGroup getGroup(String attributeNameOrPath)
          Returns AttributeGroup corresponding to the passed (possibly nested) attribute.
 org.eclipse.persistence.internal.queries.AttributeItem getItem(String attributeNameOrPath)
          INTERNAL: Lookup the AttributeItemfor the provided attribute name or path.
 Map<String,org.eclipse.persistence.internal.queries.AttributeItem> getItems()
          INTERNAL:
 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.
 void removeAttribute(String attributeNameOrPath)
          Remove an attribute from the group.
 void setAttributeNames(Set attributeNames)
           
 void setName(String name)
           
 CopyGroup toCopyGroup()
           
 FetchGroup toFetchGroup()
           
 LoadGroup toLoadGroup()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeGroup

public AttributeGroup(String name)

AttributeGroup

public AttributeGroup()
Method Detail

getName

public String getName()

setName

public void setName(String name)

getAttributeNames

public Set<String> getAttributeNames()

setAttributeNames

public void setAttributeNames(Set attributeNames)

hasItems

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


getItems

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


containsAttribute

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


addAttribute

public void addAttribute(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(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(Collection<String> attrOrPaths)
Add a set of attributes to the group.


getGroup

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


getItem

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

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

removeAttribute

public void removeAttribute(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.


equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

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 Object