Top Description Fields Constructors Methods
org.eclipse.persistence.internal.jpa.metamodel

public abstract Class ManagedTypeImpl<X>

extends TypeImpl<X>
implements ManagedType<X>
Class Inheritance
All Implemented Interfaces
jakarta.persistence.metamodel.ManagedType, jakarta.persistence.metamodel.Type
Known Direct Subclasses
org.eclipse.persistence.internal.jpa.metamodel.EmbeddableTypeImpl, org.eclipse.persistence.internal.jpa.metamodel.IdentifiableTypeImpl
Type Parameters
<X>
The represented type.
Imports
java.lang.reflect.Field, .Method, java.security.AccessController, .PrivilegedActionException, java.util.Collection, .HashMap, .LinkedHashSet, .List, .Map, .Set, jakarta.persistence.metamodel.Attribute, .CollectionAttribute, .ListAttribute, .ManagedType, .MapAttribute, .PluralAttribute, .PluralAttribute.CollectionType, .SetAttribute, .SingularAttribute, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor, .MethodAttributeAccessor, org.eclipse.persistence.internal.dynamic.ValuesAccessor, org.eclipse.persistence.internal.helper.BasicTypeHelperImpl, .ClassConstants, org.eclipse.persistence.internal.localization.ExceptionLocalization, org.eclipse.persistence.internal.queries.ContainerPolicy, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, .PrivilegedGetDeclaredField, .PrivilegedGetDeclaredMethod, org.eclipse.persistence.logging.AbstractSessionLog, .SessionLog, org.eclipse.persistence.mappings.CollectionMapping, .DatabaseMapping

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
jakarta.persistence.metamodel.ManagedType

Field Summary

Modifier and TypeField and Description
protected ClassDescriptor
descriptor

Native RelationalDescriptor that contains all the mappings of this type

private Map<String, Attribute<X, ?>>
members

The map of attributes keyed on attribute string name

protected MetamodelImpl
metamodel

Reference to the metamodel that this managed type belongs to

Constructor Summary

AccessConstructor and Description
protected
ManagedTypeImpl(MetamodelImpl
- the metamodel that this managedType is associated with
metamodel
,
ClassDescriptor
- the RelationalDescriptor that defines this managedType
descriptor
)

INTERNAL: This constructor will create a ManagedType but will not initialize its member mappings.

Method Summary

Modifier and TypeMethod and Description
protected static ManagedTypeImpl<?>
create(MetamodelImpl metamodel, ClassDescriptor descriptor)

INTERNAL: Return an instance of a ManagedType based on the RelationalDescriptor parameter

public Attribute<X, ?>

Returns:

attribute with given name
getAttribute
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getAttribute.

Return the attribute of the managed type that corresponds to the specified name.
public Set<Attribute<? super X, ?>>
getAttributes()

Implements jakarta.persistence.metamodel.ManagedType.getAttributes.

Return the attributes of the managed type.
public CollectionAttribute<? super X, ?>

Returns:

CollectionAttribute of the given name
getCollection
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getCollection.

Return the Collection-valued attribute of the managed type that corresponds to the specified name.
public <E> CollectionAttribute<? super X, E>

Returns:

CollectionAttribute of the given name and element type
getCollection
(String
the name of the represented attribute
name
,
Class<E>
the element type of the represented attribute
elementType
)

Implements jakarta.persistence.metamodel.ManagedType.getCollection.

Return the Collection-valued attribute of the managed type that corresponds to the specified name and Java element type.
protected Attribute<X, ?>

Returns:

attribute with given name
getDeclaredAttribute
(String
the name of the represented attribute
name
,
boolean
true if we already know the attribute exists on the leaf
attributeKnownToExistOnLeafTarget
)

INTERNAL: Return the declared attribute of the managed type that corresponds to the specified name.

public Attribute<X, ?>

Returns:

attribute with given name
getDeclaredAttribute
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredAttribute.

Return the declared attribute of the managed type that corresponds to the specified name.
public Set<Attribute<X, ?>>
getDeclaredAttributes()

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredAttributes.

Return the attributes declared by the managed type.
public CollectionAttribute<X, ?>

Returns:

declared CollectionAttribute of the given name
getDeclaredCollection
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredCollection.

Return the Collection-valued attribute declared by the managed type that corresponds to the specified name.
public <E> CollectionAttribute<X, E>

Returns:

declared CollectionAttribute of the given name and element type
getDeclaredCollection
(String
the name of the represented attribute
name
,
Class<E>
the element type of the represented attribute
elementType
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredCollection.

Return the Collection-valued attribute declared by the managed type that corresponds to the specified name and Java element type.
public <E> ListAttribute<X, E>

Returns:

declared ListAttribute of the given name and element type
getDeclaredList
(String
the name of the represented attribute
name
,
Class<E>
the element type of the represented attribute
elementType
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredList.

Return the List-valued attribute declared by the managed type that corresponds to the specified name and Java element type.
public ListAttribute<X, ?>

Returns:

declared ListAttribute of the given name
getDeclaredList
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredList.

Return the List-valued attribute declared by the managed type that corresponds to the specified name.
public MapAttribute<X, ?, ?>

Returns:

MapAttribute of the given name
getDeclaredMap
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredMap.

Return the Map-valued attribute of the managed type that corresponds to the specified name.
public <K, V> MapAttribute<X, K, V>

Returns:

MapAttribute of the given name and key and value types
getDeclaredMap
(String
the name of the represented attribute
name
,
Class<K>
the key type of the represented attribute
keyType
,
Class<V>
the value type of the represented attribute
valueType
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredMap.

Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types.
public Set<PluralAttribute<X, ?, ?>>

Returns:

declared collection valued attributes
getDeclaredPluralAttributes
()

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredPluralAttributes.

Return all collection-valued attributes declared by the managed type.
public SetAttribute<X, ?>

Returns:

declared SetAttribute of the given name
getDeclaredSet
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredSet.

Return the Set-valued attribute declared by the managed type that corresponds to the specified name.
public <E> SetAttribute<X, E>

Returns:

declared SetAttribute of the given name and element type
getDeclaredSet
(String
the name of the represented attribute
name
,
Class<E>
the element type of the represented attribute
elementType
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredSet.

Return the Set-valued attribute declared by the managed type that corresponds to the specified name and Java element type.
public SingularAttribute<X, ?>

Returns:

declared single-valued attribute of the given name
getDeclaredSingularAttribute
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredSingularAttribute.

Return the declared single-valued attribute of the managed type that corresponds to the specified name in the represented type.
public <Y> SingularAttribute<X, Y>

Returns:

declared single-valued attribute of the given name and type
getDeclaredSingularAttribute
(String
the name of the represented attribute
name
,
Class<Y>
the type of the represented attribute
type
)

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredSingularAttribute.

Return the declared single-valued attribute of the managed type that corresponds to the specified name and Java type in the represented type.
public Set<SingularAttribute<X, ?>>

Returns:

declared single-valued attributes
getDeclaredSingularAttributes
()

Implements jakarta.persistence.metamodel.ManagedType.getDeclaredSingularAttributes.

Return the single-valued attributes declared by the managed type.
public ClassDescriptor
getDescriptor()

INTERNAL: Return the RelationalDescriptor associated with this ManagedType

public ListAttribute<? super X, ?>

Returns:

ListAttribute of the given name
getList
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getList.

Return the List-valued attribute of the managed type that corresponds to the specified name.
private ListAttribute<? super X, ?>

Returns:

ListAttribute of the given name
getList
(String
the name of the represented attribute
name
,
boolean
- flag on whether we should be doing an IAException check
performNullCheck
)

INTERNAL: Return the List-valued attribute of the managed type that corresponds to the specified name.

public <E> ListAttribute<? super X, E>

Returns:

ListAttribute of the given name and element type
getList
(String
the name of the represented attribute
name
,
Class<E>
the element type of the represented attribute
elementType
)

Implements jakarta.persistence.metamodel.ManagedType.getList.

Return the List-valued attribute of the managed type that corresponds to the specified name and Java element type.
private ManagedTypeImpl<X>

Returns:

ManagedType supertype or null if no superclass
getManagedSuperType
()

INTERNAL: Return the ManagedType that represents the superType (superclass) of the current ManagedType.

public MapAttribute<? super X, ?, ?>

Returns:

MapAttribute of the given name
getMap
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getMap.

Return the Map-valued attribute of the managed type that corresponds to the specified name.
public <K, V> MapAttribute<? super X, K, V>

Returns:

MapAttribute of the given name and key and value types
getMap
(String
the name of the represented attribute
name
,
Class<K>
the key type of the represented attribute
keyType
,
Class<V>
the value type of the represented attribute
valueType
)

Implements jakarta.persistence.metamodel.ManagedType.getMap.

Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types.
protected Map<String, Attribute<X, ?>>
getMembers()

INTERNAL: Return the Map of AttributeImpl members keyed by String.

protected MetamodelImpl
getMetamodel()

INTERNAL: Return the Metamodel that this ManagedType is associated with.

public Set<PluralAttribute<? super X, ?, ?>>

Returns:

collection valued attributes
getPluralAttributes
()

Implements jakarta.persistence.metamodel.ManagedType.getPluralAttributes.

Return all collection-valued attributes of the managed type.
public SetAttribute<? super X, ?>

Returns:

SetAttribute of the given name
getSet
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getSet.

Return the Set-valued attribute of the managed type that corresponds to the specified name.
public <E> SetAttribute<? super X, E>

Returns:

SetAttribute of the given name and element type
getSet
(String
the name of the represented attribute
name
,
Class<E>
the element type of the represented attribute
elementType
)

Implements jakarta.persistence.metamodel.ManagedType.getSet.

Return the Set-valued attribute of the managed type that corresponds to the specified name and Java element type.
public SingularAttribute<? super X, ?>

Returns:

single-valued attribute with the given name
getSingularAttribute
(String
the name of the represented attribute
name
)

Implements jakarta.persistence.metamodel.ManagedType.getSingularAttribute.

Return the single-valued attribute of the managed type that corresponds to the specified name in the represented type.
public <Y> SingularAttribute<? super X, Y>

Returns:

single-valued attribute with given name and type
getSingularAttribute
(String
the name of the represented attribute
name
,
Class<Y>
the type of the represented attribute
type
)

Implements jakarta.persistence.metamodel.ManagedType.getSingularAttribute.

Return the single-valued attribute of the managed type that corresponds to the specified name and Java type in the represented type.
public Set<SingularAttribute<? super X, ?>>

Returns:

single-valued attributes
getSingularAttributes
()

Implements jakarta.persistence.metamodel.ManagedType.getSingularAttributes.

Return the single-valued attributes of the managed type.
protected Class<?>
getTypeClassFromAttributeOrMethodLevelAccessor(DatabaseMapping mapping)

INTERNAL: Get the elementType directly from the class using a reflective method call directly on the containing java class associated with this managedType.

protected void
initialize()

INTERNAL: Initialize the members of this ManagedType based on the mappings defined on the descriptor.

private AttributeImpl<X, T>
initializePluralAttributeTypeNotFound(ManagedTypeImpl<X> managedType, CollectionMapping collectionMapping, boolean validation)

INTERNAL: Handle the case where we were unable to determine the element type of the plural attribute.

private boolean

Returns:

true if the attribute is declared at this first level, false if no attribute is found in the superTree, or false if the attribute is found declared higher up in the inheritance superTree
isAttributeDeclaredOnlyInLeafType
(String
- String name of possible declared attribute search
attributeName
)

INTERNAL: Recursively search the superclass tree of the current managedType for the named attribute.

private boolean

Returns:

true if the attribute is declared at this first level, false if no attribute is found in the superTree, or false if the attribute is found declared higher up in the inheritance superTree
isAttributeDeclaredOnlyInLeafType
(String
- String name of possible declared attribute search
attributeName
,
Attribute<X, Y> firstLevelAttribute)

INTERNAL: Recursively search the superclass tree of the current managedType for the named attribute.

private boolean
isAutoboxedType(Class<?>
(the type we are verifying against)
targetPrimitiveOrWrapperClass
,
Class<?>
(the type that may be the autoboxed or primitive equal
actualPrimitiveOrWrapperClass
)

INTERNAL: This function returns whether the Object class passed in can be autoboxed (a primitive wrapped in its' object type) or the reverse - an autoboxed object that wraps a primitive type).

protected boolean
isIdentifiableType()

Implements abstract org.eclipse.persistence.internal.jpa.metamodel.TypeImpl.isIdentifiableType.

INTERNAL: Return whether this type is identifiable.
protected boolean
isManagedType()

Implements abstract org.eclipse.persistence.internal.jpa.metamodel.TypeImpl.isManagedType.

INTERNAL: Return whether this type is identifiable.
protected void
toStringHelper(StringBuffer aBuffer)

Implements abstract org.eclipse.persistence.internal.jpa.metamodel.TypeImpl.toStringHelper.

INTERNAL: Append the partial string representation of the receiver to the StringBuffer.
private void
verifyAttributeTypeAndReturnType(Attribute<X, Y>
- the Attribute we are verifying
anAttribute
,
Class<?>
- the java element or basic element type
attributeElementType
,
PluralAttribute.CollectionType
- the plural return type
aReturnCollectionType
)

INTERNAL: Perform type checking on the attribute and return types of the named attribute.

Inherited from org.eclipse.persistence.internal.jpa.metamodel.TypeImpl:
getJavaTypegetJavaTypegetJavaTypeNameisEntityisMappedSuperclasstoString