Class CoreAttributeGroup<ATTRIBUTE_ITEM extends CoreAttributeItem,DESCRIPTOR extends CoreDescriptor>
java.lang.Object
org.eclipse.persistence.core.queries.CoreAttributeGroup<ATTRIBUTE_ITEM,DESCRIPTOR>
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
AttributeGroup
public class CoreAttributeGroup<ATTRIBUTE_ITEM extends CoreAttributeItem,DESCRIPTOR extends CoreDescriptor>
extends Object
implements Serializable, Cloneable
INTERNAL
Purpose: A generic super class for AttributeGroup and other subclasses
- See Also:
- Author:
- Matt MacIvor
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<Object,
CoreAttributeGroup> This attribute is used to store all of the classes in this hierarchy keyed by type.protected boolean
Marks this AttributeGroup as having been validated by the builder and does not require further validationprotected Map<String,
ATTRIBUTE_ITEM> Specified attributes in the group mapped to their AttributeItemsprotected String
Name of the group.protected Set<CoreAttributeGroup>
This attribute references the immediate subclass groups for this attributeGroup.protected CoreAttributeGroup
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 Class
The class represented by this AttrbuteGroup.protected String
The name of the class represented by this AttrbuteGroup. -
Constructor Summary
ConstructorDescriptionCoreAttributeGroup
(String name) CoreAttributeGroup
(String name, Class type, boolean isValidated) INTERNAL: This constructer is to only be used by EclipseLink internallyCoreAttributeGroup
(String name, String type, boolean isValidated) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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, Collection<? extends CoreAttributeGroup> groups) Add an attribute and the corresponding list of AttributeGroups.void
addAttribute
(String attributeNameOrPath, CoreAttributeGroup 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
addAttributeKey
(String attributeNameOrPath, CoreAttributeGroup 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
(Collection<String> attrOrPaths) Add a set of attributes to the group.clone()
clone
(Map<CoreAttributeGroup<ATTRIBUTE_ITEM, DESCRIPTOR>, CoreAttributeGroup<ATTRIBUTE_ITEM, DESCRIPTOR>> cloneMap) INTERNAL: This method is used internally in the clone processing.boolean
containsAttribute
(String attributeNameOrPath) Return if the attribute is defined in the group.boolean
containsAttributeInternal
(String attributeName) INTERNAL: Return if the attribute is defined in the group.protected String[]
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
(ClassLoader classLoader) INTERNAL: Convert all the class-name-based settings in this Descriptor to actual class-based settings.boolean
findGroup
(DESCRIPTOR type) INTERNAL:Returns AttributeGroup corresponding to the passed (possibly nested) attribute.INTERNAL: Lookup theAttributeItem
for the provided attribute name or path.protected ATTRIBUTE_ITEM
Locate the AttributeGroup where the leaf attribute in the path should be applied to.getItems()
INTERNAL:getName()
INTERNAL:getType()
INTERNAL: Returns the name of the type this group representsint
hashCode()
boolean
Indicates whether this group is part of an inheritance hierarchyboolean
hasItems()
Indicates whether the group has at least one attribute.void
insertSubClass
(CoreAttributeGroup group) INTERNAL: This method will insert the group into the entity hierarchy just below this AttributeGroup.boolean
INTERNAL: Only LoadGroups allow concurrency.boolean
INTERNAL: This method is used internally when converting to a copy group.boolean
boolean
boolean
isSupersetOf
(CoreAttributeGroup<ATTRIBUTE_ITEM, DESCRIPTOR> anotherGroup) Return true if this AttributeGroup is a super-set of the passed in AttributeGroup.boolean
INTERNAL:protected CoreAttributeGroup
newGroup
(String name, CoreAttributeGroup parent) Subclass may create different types.protected CoreAttributeItem
newItem
(CoreAttributeGroup group, String attrName) Subclass may create different types.void
removeAttribute
(String attributeNameOrPath) Remove an attribute from the group.void
setAllSubclasses
(Map<Object, CoreAttributeGroup> subclasses) INTERNAL:void
setAttributeNames
(Set attributeNames) void
toString()
protected String
Used by toString to print additional info for derived classes.protected String
Used by toString to print attribute items.protected static String
toStringPath
(String[] attributePath, int position)
-
Field Details
-
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
The name of the class represented by this AttrbuteGroup. Used to specify overriding groups for subclasses. -
type
The class represented by this AttrbuteGroup. Used to specify overriding groups for subclasses. -
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
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
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
Specified attributes in the group mapped to their AttributeItems -
isValidated
protected boolean isValidatedMarks this AttributeGroup as having been validated by the builder and does not require further validation
-
-
Constructor Details
-
CoreAttributeGroup
-
CoreAttributeGroup
-
CoreAttributeGroup
INTERNAL: This constructer is to only be used by EclipseLink internally- Parameters:
name
-type
-
-
CoreAttributeGroup
public CoreAttributeGroup()
-
-
Method Details
-
addAttribute
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:
attributeNameOrPath
- A simple attribute, array or attributes forming a path
-
addAttribute
public void addAttribute(String attributeNameOrPath, Collection<? extends CoreAttributeGroup> groups) Add an attribute and the corresponding list of AttributeGroups. Multiple groups are added in the case of inheritance- Parameters:
attributeNameOrPath
- A simple attribute, array or attributes forming a pathgroups
- - a collection of AttributeGroups to be added.
-
addAttribute
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);
Note that existing group corresponding to attributeNameOrPath will be overridden with the passed group.
group.addAttribute("manager.address", group2);- Parameters:
attributeNameOrPath
- A simple attribute, array or attributes forming a pathgroup
- - an AttributeGroup to be added.
-
addAttributeKey
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);
Note that existing group corresponding to attributeNameOrPath will be overridden with the passed group.
group.addAttribute("manager.address", group2);- Parameters:
attributeNameOrPath
- A simple attribute, array or attributes forming a path to a Map keygroup
- - an AttributeGroup to be added.
-
addAttributes
Add a set of attributes to the group. -
clone
-
clone
public CoreAttributeGroup clone(Map<CoreAttributeGroup<ATTRIBUTE_ITEM, DESCRIPTOR>, CoreAttributeGroup<ATTRIBUTE_ITEM, DESCRIPTOR>> cloneMap) INTERNAL: This method is used internally in the clone processing.- Parameters:
cloneMap
-- Returns:
-
containsAttribute
Return if the attribute is defined in the group. -
containsAttributeInternal
INTERNAL: Return if the attribute is defined in the group. Only local attribute names are checked. -
convert
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:
IllegalArgumentException
- if name is not valid attribute name or path.
-
convertClassNamesToClasses
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
-
hashCode
public int hashCode() -
findGroup
-
getAllItems
INTERNAL: -
getAttributeNames
-
getGroup
Returns AttributeGroup corresponding to the passed (possibly nested) attribute. -
getItem
INTERNAL: Lookup theAttributeItem
for the provided attribute name or path.- Returns:
- item or null
- Throws:
IllegalArgumentException
- if name is not valid attribute name or path
-
getItem
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
-
getItems
INTERNAL:- Returns:
- Non-null Map of attributes in the group mapped to their AttributeItems
-
getName
-
getSubClassGroups
INTERNAL: -
getType
-
getTypeName
INTERNAL: Returns the name of the type this group represents -
hasInheritance
public boolean hasInheritance()Indicates whether this group is part of an inheritance hierarchy -
hasItems
public boolean hasItems()Indicates whether the group has at least one attribute. -
insertSubClass
INTERNAL: This method will insert the group into the entity hierarchy just below this AttributeGroup.- Parameters:
group
-
-
isConcurrent
public boolean isConcurrent()INTERNAL: Only LoadGroups allow concurrency. -
isCopyGroup
public boolean isCopyGroup()INTERNAL: This method is used internally when converting to a copy group.- Returns:
-
isFetchGroup
public boolean isFetchGroup() -
isLoadGroup
public boolean isLoadGroup() -
isSupersetOf
Return true if this AttributeGroup is a super-set of the passed in AttributeGroup. -
isValidated
public boolean isValidated()INTERNAL:- Returns:
- the isValidated
-
newGroup
Subclass may create different types. -
newItem
Subclass may create different types. -
removeAttribute
Remove an attribute from the group. -
setAllSubclasses
INTERNAL: -
setAttributeNames
-
setName
-
toString
-
toStringAdditionalInfo
Used by toString to print additional info for derived classes. -
toStringItems
Used by toString to print attribute items. -
toStringPath
-