Module org.eclipse.persistence.jpa
Class ManagedTypeImpl<X>
java.lang.Object
org.eclipse.persistence.internal.jpa.metamodel.TypeImpl<X>
org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl<X>
- Type Parameters:
X- The represented type.
- All Implemented Interfaces:
ManagedType<X>,Type<X>,Serializable
- Direct Known Subclasses:
EmbeddableTypeImpl,IdentifiableTypeImpl
Purpose: Provides the implementation for the ManagedType interface of the JPA 2.0 Metamodel API (part of the JSR-317 EJB 3.1 Criteria API)
Description: Instances of the type ManagedType represent entities, mapped superclasses and embeddable types.
- Since:
- EclipseLink 1.2 - JPA 2.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface jakarta.persistence.metamodel.Type
Type.PersistenceType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClassDescriptorNative RelationalDescriptor that contains all the mappings of this typeprotected MetamodelImplReference to the metamodel that this managed type belongs to -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedManagedTypeImpl(MetamodelImpl metamodel, ClassDescriptor descriptor) INTERNAL: This constructor will create a ManagedType but will not initialize its member mappings. -
Method Summary
Modifier and TypeMethodDescriptionprotected static ManagedTypeImpl<?> create(MetamodelImpl metamodel, ClassDescriptor descriptor) INTERNAL: Return an instance of a ManagedType based on the RelationalDescriptor parametergetAttribute(String name) Return the attribute of the managed type that corresponds to the specified name.Return the attributes of the managed type.CollectionAttribute<? super X, ?> getCollection(String name) Return the Collection-valued attribute of the managed type that corresponds to the specified name.<E> CollectionAttribute<? super X, E> getCollection(String name, Class<E> elementType) Return the Collection-valued attribute of the managed type that corresponds to the specified name and Java element type.getDeclaredAttribute(String name) Return the declared attribute of the managed type that corresponds to the specified name.getDeclaredAttribute(String name, boolean attributeKnownToExistOnLeafTarget) INTERNAL: Return the declared attribute of the managed type that corresponds to the specified name.Return the attributes declared by the managed type.getDeclaredCollection(String name) Return the Collection-valued attribute declared by the managed type that corresponds to the specified name.<E> CollectionAttribute<X, E> getDeclaredCollection(String name, Class<E> elementType) Return the Collection-valued attribute declared by the managed type that corresponds to the specified name and Java element type.ListAttribute<X, ?> getDeclaredList(String name) Return the List-valued attribute declared by the managed type that corresponds to the specified name.<E> ListAttribute<X, E> getDeclaredList(String name, Class<E> elementType) Return the List-valued attribute declared by the managed type that corresponds to the specified name and Java element type.MapAttribute<X, ?, ?> getDeclaredMap(String name) Return the Map-valued attribute of the managed type that corresponds to the specified name.<K,V> MapAttribute <X, K, V> getDeclaredMap(String name, Class<K> keyType, Class<V> valueType) Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types.Set<PluralAttribute<X, ?, ?>> Return all collection-valued attributes declared by the managed type.SetAttribute<X, ?> getDeclaredSet(String name) Return the Set-valued attribute declared by the managed type that corresponds to the specified name.<E> SetAttribute<X, E> getDeclaredSet(String name, Class<E> elementType) Return the Set-valued attribute declared by the managed type that corresponds to the specified name and Java element type.Return the declared single-valued attribute of the managed type that corresponds to the specified name in the represented type.<Y> SingularAttribute<X, Y> getDeclaredSingularAttribute(String name, Class<Y> type) Return the declared single-valued attribute of the managed type that corresponds to the specified name and Java type in the represented type.Set<SingularAttribute<X, ?>> Return the single-valued attributes declared by the managed type.INTERNAL: Return the RelationalDescriptor associated with this ManagedTypeListAttribute<? super X, ?> Return the List-valued attribute of the managed type that corresponds to the specified name.<E> ListAttribute<? super X, E> Return the List-valued attribute of the managed type that corresponds to the specified name and Java element type.MapAttribute<? super X, ?, ?> Return the Map-valued attribute of the managed type that corresponds to the specified name.<K,V> MapAttribute <? super X, K, V> Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types.INTERNAL: Return the Map of AttributeImpl members keyed by String.protected MetamodelImplINTERNAL: Return the Metamodel that this ManagedType is associated with.Set<PluralAttribute<? super X, ?, ?>> Return all collection-valued attributes of the managed type.SetAttribute<? super X, ?> Return the Set-valued attribute of the managed type that corresponds to the specified name.<E> SetAttribute<? super X, E> Return the Set-valued attribute of the managed type that corresponds to the specified name and Java element type.SingularAttribute<? super X, ?> getSingularAttribute(String name) Return the single-valued attribute of the managed type that corresponds to the specified name in the represented type.<Y> SingularAttribute<? super X, Y> getSingularAttribute(String name, Class<Y> type) Return the single-valued attribute of the managed type that corresponds to the specified name and Java type in the represented type.Set<SingularAttribute<? super X, ?>> Return the single-valued attributes of the managed type.protected Class<?> INTERNAL: Get the elementType directly from the class using a reflective method call directly on the containing java class associated with this managedType.protected voidINTERNAL: Initialize the members of this ManagedType based on the mappings defined on the descriptor.protected booleanINTERNAL: Return whether this type is identifiable.protected booleanINTERNAL: Return whether this type is identifiable.protected voidtoStringHelper(StringBuffer aBuffer) INTERNAL: Append the partial string representation of the receiver to the StringBuffer.Methods inherited from class org.eclipse.persistence.internal.jpa.metamodel.TypeImpl
getJavaType, getJavaType, getJavaTypeName, isEntity, isMappedSuperclass, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface jakarta.persistence.metamodel.Type
getJavaType, getPersistenceType
-
Field Details
-
descriptor
Native RelationalDescriptor that contains all the mappings of this type -
metamodel
Reference to the metamodel that this managed type belongs to
-
-
Constructor Details
-
ManagedTypeImpl
INTERNAL: This constructor will create a ManagedType but will not initialize its member mappings. This is accomplished by delayed initialization in MetamodelImpl.initialize() in order that we have access to all types when resolving relationships in mappings.- Parameters:
metamodel- - the metamodel that this managedType is associated withdescriptor- - the RelationalDescriptor that defines this managedType
-
-
Method Details
-
getAttribute
Return the attribute of the managed type that corresponds to the specified name.- Specified by:
getAttributein interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- attribute with given name
- Throws:
IllegalArgumentException- if attribute of the given name is not present in the managed type
-
getAttributes
Return the attributes of the managed type.- Specified by:
getAttributesin interfaceManagedType<X>
-
getCollection
Return the Collection-valued attribute of the managed type that corresponds to the specified name.- Specified by:
getCollectionin interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- CollectionAttribute of the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not present in the managed type
-
getCollection
Return the Collection-valued attribute of the managed type that corresponds to the specified name and Java element type.- Specified by:
getCollectionin interfaceManagedType<X>- Parameters:
name- the name of the represented attributeelementType- the element type of the represented attribute- Returns:
- CollectionAttribute of the given name and element type
- Throws:
IllegalArgumentException- if attribute of the given name and type is not present in the managed type
-
getPluralAttributes
Return all collection-valued attributes of the managed type.- Specified by:
getPluralAttributesin interfaceManagedType<X>- Returns:
- collection valued attributes
-
getDeclaredAttribute
protected Attribute<X,?> getDeclaredAttribute(String name, boolean attributeKnownToExistOnLeafTarget) INTERNAL: Return the declared attribute of the managed type that corresponds to the specified name.- Parameters:
name- the name of the represented attributeattributeKnownToExistOnLeafTarget- true if we already know the attribute exists on the leaf- Returns:
- attribute with given name
- Throws:
IllegalArgumentException- if attribute of the given name is not declared in the managed type
-
getDeclaredAttribute
Return the declared attribute of the managed type that corresponds to the specified name.- Specified by:
getDeclaredAttributein interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- attribute with given name
- Throws:
IllegalArgumentException- if attribute of the given name is not declared in the managed type
-
getDeclaredAttributes
Return the attributes declared by the managed type.- Specified by:
getDeclaredAttributesin interfaceManagedType<X>
-
getDeclaredCollection
Return the Collection-valued attribute declared by the managed type that corresponds to the specified name.- Specified by:
getDeclaredCollectionin interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- declared CollectionAttribute of the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not declared in the managed type
-
getDeclaredCollection
Return the Collection-valued attribute declared by the managed type that corresponds to the specified name and Java element type.- Specified by:
getDeclaredCollectionin interfaceManagedType<X>- Parameters:
name- the name of the represented attributeelementType- the element type of the represented attribute- Returns:
- declared CollectionAttribute of the given name and element type
- Throws:
IllegalArgumentException- if attribute of the given name and type is not declared in the managed type
-
getDeclaredPluralAttributes
Return all collection-valued attributes declared by the managed type.- Specified by:
getDeclaredPluralAttributesin interfaceManagedType<X>- Returns:
- declared collection valued attributes
-
create
INTERNAL: Return an instance of a ManagedType based on the RelationalDescriptor parameter -
getDeclaredList
Return the List-valued attribute declared by the managed type that corresponds to the specified name and Java element type.- Specified by:
getDeclaredListin interfaceManagedType<X>- Parameters:
name- the name of the represented attributeelementType- the element type of the represented attribute- Returns:
- declared ListAttribute of the given name and element type
- Throws:
IllegalArgumentException- if attribute of the given name and type is not declared in the managed type
-
getDeclaredList
Return the List-valued attribute declared by the managed type that corresponds to the specified name.- Specified by:
getDeclaredListin interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- declared ListAttribute of the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not declared in the managed type
-
getDeclaredMap
Return the Map-valued attribute of the managed type that corresponds to the specified name.- Specified by:
getDeclaredMapin interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- MapAttribute of the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not present in the managed type
-
getDeclaredMap
Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types.- Specified by:
getDeclaredMapin interfaceManagedType<X>- Parameters:
name- the name of the represented attributekeyType- the key type of the represented attributevalueType- the value type of the represented attribute- Returns:
- MapAttribute of the given name and key and value types
- Throws:
IllegalArgumentException- if attribute of the given name and type is not present in the managed type
-
getDeclaredSet
Return the Set-valued attribute declared by the managed type that corresponds to the specified name.- Specified by:
getDeclaredSetin interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- declared SetAttribute of the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not declared in the managed type
-
getDeclaredSet
Return the Set-valued attribute declared by the managed type that corresponds to the specified name and Java element type.- Specified by:
getDeclaredSetin interfaceManagedType<X>- Parameters:
name- the name of the represented attributeelementType- the element type of the represented attribute- Returns:
- declared SetAttribute of the given name and element type
- Throws:
IllegalArgumentException- if attribute of the given name and type is not declared in the managed type
-
getDeclaredSingularAttribute
Return the declared single-valued attribute of the managed type that corresponds to the specified name in the represented type.- Specified by:
getDeclaredSingularAttributein interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- declared single-valued attribute of the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not declared in the managed type
-
getDeclaredSingularAttribute
Return the declared single-valued attribute of the managed type that corresponds to the specified name and Java type in the represented type.- Specified by:
getDeclaredSingularAttributein interfaceManagedType<X>- Parameters:
name- the name of the represented attributetype- the type of the represented attribute- Returns:
- declared single-valued attribute of the given name and type
- Throws:
IllegalArgumentException- if attribute of the given name and type is not declared in the managed type
-
getDeclaredSingularAttributes
Return the single-valued attributes declared by the managed type.- Specified by:
getDeclaredSingularAttributesin interfaceManagedType<X>- Returns:
- declared single-valued attributes
-
getDescriptor
INTERNAL: Return the RelationalDescriptor associated with this ManagedType -
getList
Return the List-valued attribute of the managed type that corresponds to the specified name.- Specified by:
getListin interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- ListAttribute of the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not present in the managed type
-
getList
Return the List-valued attribute of the managed type that corresponds to the specified name and Java element type.- Specified by:
getListin interfaceManagedType<X>- Parameters:
name- the name of the represented attributeelementType- the element type of the represented attribute- Returns:
- ListAttribute of the given name and element type
- Throws:
IllegalArgumentException- if attribute of the given name and type is not present in the managed type
-
getMap
Return the Map-valued attribute of the managed type that corresponds to the specified name.- Specified by:
getMapin interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- MapAttribute of the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not present in the managed type
-
getMap
Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types.- Specified by:
getMapin interfaceManagedType<X>- Parameters:
name- the name of the represented attributekeyType- the key type of the represented attributevalueType- the value type of the represented attribute- Returns:
- MapAttribute of the given name and key and value types
- Throws:
IllegalArgumentException- if attribute of the given name and type is not present in the managed type
-
getMembers
INTERNAL: Return the Map of AttributeImpl members keyed by String. -
getMetamodel
INTERNAL: Return the Metamodel that this ManagedType is associated with. -
getSet
Return the Set-valued attribute of the managed type that corresponds to the specified name.- Specified by:
getSetin interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- SetAttribute of the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not present in the managed type
-
getSet
Return the Set-valued attribute of the managed type that corresponds to the specified name and Java element type.- Specified by:
getSetin interfaceManagedType<X>- Parameters:
name- the name of the represented attributeelementType- the element type of the represented attribute- Returns:
- SetAttribute of the given name and element type
- Throws:
IllegalArgumentException- if attribute of the given name and type is not present in the managed type
-
getSingularAttribute
Return the single-valued attribute of the managed type that corresponds to the specified name in the represented type.- Specified by:
getSingularAttributein interfaceManagedType<X>- Parameters:
name- the name of the represented attribute- Returns:
- single-valued attribute with the given name
- Throws:
IllegalArgumentException- if attribute of the given name is not present in the managed type
-
getSingularAttribute
Return the single-valued attribute of the managed type that corresponds to the specified name and Java type in the represented type.- Specified by:
getSingularAttributein interfaceManagedType<X>- Parameters:
name- the name of the represented attributetype- the type of the represented attribute- Returns:
- single-valued attribute with given name and type
- Throws:
IllegalArgumentException- if attribute of the given name and type is not present in the managed type
-
getSingularAttributes
Return the single-valued attributes of the managed type.- Specified by:
getSingularAttributesin interfaceManagedType<X>- Returns:
- single-valued attributes
-
initialize
protected void initialize()INTERNAL: Initialize the members of this ManagedType based on the mappings defined on the descriptor. We process the appropriate Map, List, Set, Collection or Object/primitive types.Initialization should occur after all types in the metamodel have been created already.
-
getTypeClassFromAttributeOrMethodLevelAccessor
INTERNAL: Get the elementType directly from the class using a reflective method call directly on the containing java class associated with this managedType. -
isIdentifiableType
protected boolean isIdentifiableType()INTERNAL: Return whether this type is identifiable. This would be EntityType and MappedSuperclassType- Specified by:
isIdentifiableTypein classTypeImpl<X>
-
isManagedType
protected boolean isManagedType()INTERNAL: Return whether this type is identifiable. This would be EmbeddableType as well as EntityType and MappedSuperclassType- Specified by:
isManagedTypein classTypeImpl<X>
-
toStringHelper
INTERNAL: Append the partial string representation of the receiver to the StringBuffer.- Specified by:
toStringHelperin classTypeImpl<X>
-