EclipseLink 2.4.2, build 'v20130514-5956486' 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.Object,AttributeGroup> allsubclasses
          This attribute is used to store all of the classes in this hierarchy keyed by type.
protected  java.util.Map<java.lang.String,org.eclipse.persistence.internal.queries.AttributeItem> items
          Specified attributes in the group mapped to their AttributeItems
protected  java.lang.String name
          Name of the group.
protected  java.util.Set<AttributeGroup> subClasses
          This attribute references the immediate subclass groups for this attributeGroup.
protected  AttributeGroup superClassGroup
          To add inheritance support the two following attrbutes are used to create a model of the inheritance tree This attribute points to the parent AttributeGroup of this attribute group.
protected  java.lang.Class type
          The class represented by this AttrbuteGroup.
protected  java.lang.String typeName
          The name of the class represented by this AttrbuteGroup.
 
Constructor Summary
AttributeGroup()
           
AttributeGroup(java.lang.String name)
           
AttributeGroup(java.lang.String name, java.lang.Class type, boolean isValidated)
          INTERNAL: This constructer is to only be used by EclipseLink internally
AttributeGroup(java.lang.String name, java.lang.String type, boolean isValidated)
           
 
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 addAttribute(java.lang.String attributeNameOrPath, java.util.Collection<AttributeGroup> groups)
          Add an attribute and the corresponding list of AttributeGroups.
 void addAttributeKey(java.lang.String attributeNameOrPath, AttributeGroup group)
          Add a basic attribute or nested attribute with each String representing the key of an attribute of type Map 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()
           
 AttributeGroup clone(java.util.Map<AttributeGroup,AttributeGroup> cloneMap)
          INTERNAL: This method is used internally in the clone processing.
 boolean containsAttribute(java.lang.String attributeNameOrPath)
          Return if the attribute is defined in the group.
 boolean containsAttributeInternal(java.lang.String attributeName)
          INTERNAL: 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.
 void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
          INTERNAL: Convert all the class-name-based settings in this Descriptor to actual class-based settings.
 boolean equals(java.lang.Object obj)
           
 AttributeGroup findGroup(ClassDescriptor type)
           
 java.util.Map<java.lang.String,org.eclipse.persistence.internal.queries.AttributeItem> getAllItems()
          INTERNAL:
 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.
protected  org.eclipse.persistence.internal.queries.AttributeItem getItem(java.lang.String[] attributePath, boolean create)
          Locate the AttributeGroup where the leaf attribute in the path should be applied to.
 java.util.Map<java.lang.String,org.eclipse.persistence.internal.queries.AttributeItem> getItems()
          INTERNAL:
 java.lang.String getName()
           
 java.util.Map<java.lang.Object,AttributeGroup> getSubClassGroups()
          INTERNAL:
 java.lang.Class getType()
           
 java.lang.String getTypeName()
          INTERNAL: Returns the name of the type this group represents
 boolean hasInheritance()
          Indicates whether this group is part of an inheritance hierarchy
 boolean hasItems()
          Indicates whether the group has at least one attribute.
 void insertSubClass(AttributeGroup group)
          INTERNAL: This method will insert the group into the entity hierarchy just below this AttributeGroup.
 boolean isConcurrent()
          INTERNAL: Only LoadGroups allow concurrency.
 boolean isCopyGroup()
          INTERNAL: This method is used internally when converting to a copy group.
 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 setAllSubclasses(java.util.Map<java.lang.Object,AttributeGroup> subclasses)
          INTERNAL:
 void setAttributeNames(java.util.Set attributeNames)
           
 void setName(java.lang.String name)
           
 CopyGroup toCopyGroup()
          Convert the group to a CopyGroup for usage with the copy() API.
 CopyGroup toCopyGroup(java.util.Map<AttributeGroup,CopyGroup> cloneMap, java.util.Map copies)
          INTERNAL: This method is used internally when converting to a copy group.
 FetchGroup toFetchGroup()
          Convert the group to a FetchGroup for usage with queries.
 FetchGroup toFetchGroup(java.util.Map<AttributeGroup,FetchGroup> cloneMap)
          INTERNAL: This method is used internally when converting to a copy group.
 LoadGroup toLoadGroup()
          Convert the group to a LoadGroup for usage with queries.
 LoadGroup toLoadGroup(java.util.Map<AttributeGroup,LoadGroup> cloneMap, boolean loadOnly)
           
 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

name

protected java.lang.String name
Name of the group. This is used in subclasses where the groups are stored and can be used within a query by name as with FetchGroup. For dynamic groups the name has no functional value.


typeName

protected java.lang.String typeName
The name of the class represented by this AttrbuteGroup. Used to specify overriding groups for subclasses.


type

protected java.lang.Class type
The class represented by this AttrbuteGroup. Used to specify overriding groups for subclasses.


superClassGroup

protected AttributeGroup superClassGroup
To add inheritance support the two following attrbutes are used to create a model of the inheritance tree This attribute points to the parent AttributeGroup of this attribute group.


subClasses

protected transient java.util.Set<AttributeGroup> subClasses
This attribute references the immediate subclass groups for this attributeGroup. This is not required but acts as a means to support adding inheritance branches into the an established tree.


allsubclasses

protected java.util.Map<java.lang.Object,AttributeGroup> allsubclasses
This attribute is used to store all of the classes in this hierarchy keyed by type. It is used to find the correct graph for polymorphic groups.


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(java.lang.String name,
                      java.lang.Class type,
                      boolean isValidated)
INTERNAL: This constructer is to only be used by EclipseLink internally

Parameters:
name -
type -

AttributeGroup

public AttributeGroup(java.lang.String name,
                      java.lang.String type,
                      boolean isValidated)

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)

findGroup

public AttributeGroup findGroup(ClassDescriptor type)

getAttributeNames

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

getType

public java.lang.Class getType()

getTypeName

public java.lang.String getTypeName()
INTERNAL: Returns the name of the type this group represents


setAttributeNames

public void setAttributeNames(java.util.Set attributeNames)

setAllSubclasses

public void setAllSubclasses(java.util.Map<java.lang.Object,AttributeGroup> subclasses)
INTERNAL:


hasItems

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


hasInheritance

public boolean hasInheritance()
Indicates whether this group is part of an inheritance hierarchy


getSubClassGroups

public java.util.Map<java.lang.Object,AttributeGroup> getSubClassGroups()
INTERNAL:


getItems

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


getAllItems

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


containsAttributeInternal

public boolean containsAttributeInternal(java.lang.String attributeName)
INTERNAL: Return if the attribute is defined in the group. Only local attribute names are checked.


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.

addAttribute

public void addAttribute(java.lang.String attributeNameOrPath,
                         java.util.Collection<AttributeGroup> groups)
Add an attribute and the corresponding list of AttributeGroups. Multiple groups are added in the case of inheritance

Parameters:
attrPathOrName - A simple attribute, array or attributes forming a path
group - - a collection of AttributeGroups to be added.

addAttributeKey

public void addAttributeKey(java.lang.String attributeNameOrPath,
                            AttributeGroup group)
Add a basic attribute or nested attribute with each String representing the key of an attribute of type Map 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 to a Map key
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

getItem

protected org.eclipse.persistence.internal.queries.AttributeItem getItem(java.lang.String[] attributePath,
                                                                         boolean create)
Locate the AttributeGroup where the leaf attribute in the path should be applied to.

Parameters:
create - indicates if intermediate AttributeGroup required within the specified path should be created as needed. When checking the state of the map callers should set this to false to avoid changing the state unexpectedly

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

convertClassNamesToClasses

public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this Descriptor to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.

Parameters:
classLoader -

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()
Convert the group to a FetchGroup for usage with queries.


toFetchGroup

public FetchGroup toFetchGroup(java.util.Map<AttributeGroup,FetchGroup> cloneMap)
INTERNAL: This method is used internally when converting to a copy group.

Parameters:
cloneMap -
Returns:

isCopyGroup

public boolean isCopyGroup()
INTERNAL: This method is used internally when converting to a copy group.

Parameters:
cloneMap -
Returns:

toCopyGroup

public CopyGroup toCopyGroup()
Convert the group to a CopyGroup for usage with the copy() API.


toCopyGroup

public CopyGroup toCopyGroup(java.util.Map<AttributeGroup,CopyGroup> cloneMap,
                             java.util.Map copies)
INTERNAL: This method is used internally when converting to a copy group.

Parameters:
cloneMap -
Returns:

isLoadGroup

public boolean isLoadGroup()

toLoadGroup

public LoadGroup toLoadGroup()
Convert the group to a LoadGroup for usage with queries.


toLoadGroup

public LoadGroup toLoadGroup(java.util.Map<AttributeGroup,LoadGroup> cloneMap,
                             boolean loadOnly)

clone

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

clone

public AttributeGroup clone(java.util.Map<AttributeGroup,AttributeGroup> cloneMap)
INTERNAL: This method is used internally in the clone processing.

Parameters:
cloneMap -
Returns:

isConcurrent

public boolean isConcurrent()
INTERNAL: Only LoadGroups allow concurrency.


insertSubClass

public void insertSubClass(AttributeGroup group)
INTERNAL: This method will insert the group into the entity hierarchy just below this AttributeGroup.

Parameters:
group -

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference