Class AbstractManagedType<X>
java.lang.Object
org.apache.openjpa.persistence.meta.AbstractManagedType<X>
- Type Parameters:
X
- the
- All Implemented Interfaces:
jakarta.persistence.metamodel.ManagedType<X>
,jakarta.persistence.metamodel.Type<X>
- Direct Known Subclasses:
Types.Embeddable
,Types.Identifiable
,Types.PseudoEntity
public abstract class AbstractManagedType<X>
extends Object
implements jakarta.persistence.metamodel.ManagedType<X>
Implements the managed persistent type and its attributes.
Provides identity and version attribute facilities for Identifiable type but does not
implement it.
- Author:
- Pinaki Poddar
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
Selects if the attribute type matches the given Java class.static final class
static final class
Selects plural attribute of given element type.static final class
static interface
Affirms if a given element satisfy a condition.static final class
static final class
static final class
Affirms if the given attribute is a Singular attribute.static final class
Nested classes/interfaces inherited from interface jakarta.persistence.metamodel.Type
jakarta.persistence.metamodel.Type.PersistenceType
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractManagedType
(Class<X> cls, MetamodelImpl model) A protected constructor for creating psudo-managed types.AbstractManagedType
(ClassMetaData meta, MetamodelImpl model) Construct a managed type. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
C extends Collection<E>, E>
Cfilter
(Collection<T> original, C result, AbstractManagedType.Filter<T> f1, AbstractManagedType.Filter<T> f2, AbstractManagedType.Filter<T> f3, AbstractManagedType.Filter<T> f4) Applies chain of filters ANDed on the given collection to populate the given result.jakarta.persistence.metamodel.Attribute<? super X,
?> getAttribute
(String name) Returns the attribute of the given name of any type.<Y> jakarta.persistence.metamodel.Attribute<? super X,
Y> getAttribute
(String name, Class<Y> type) Returns the attribute of the given name and Java type.Returns all the attributes of the managed type including attributes of the super type.jakarta.persistence.metamodel.CollectionAttribute<? super X,
?> getCollection
(String name) Returns the attribute of the given name and of type java.util.Collection.<E> jakarta.persistence.metamodel.CollectionAttribute<? super X,
E> getCollection
(String name, Class<E> elementType) Returns the attribute of the given name, of type java.util.Collection and contains the given element type.jakarta.persistence.metamodel.Attribute<X,
?> getDeclaredAttribute
(String name) Returns the declared attribute of the given name of any type.<Y> jakarta.persistence.metamodel.Attribute<X,
Y> getDeclaredAttribute
(String name, Class<Y> type) Returns the declared attribute of the given name and Java type.Returns all the attributes declared by this managed type only.jakarta.persistence.metamodel.CollectionAttribute<X,
?> getDeclaredCollection
(String name) Returns the declared attribute of the given name and of type java.util.Collection.<E> jakarta.persistence.metamodel.CollectionAttribute<X,
E> getDeclaredCollection
(String name, Class<E> elementType) Returns the declared attribute of the given name, of type java.util.Collection and contains the given element type.final <Y> jakarta.persistence.metamodel.SingularAttribute<X,
Y> getDeclaredId
(Class<Y> type) Returns the declared attribute of given type that corresponds to the id attribute of this identifiable managed type.jakarta.persistence.metamodel.ListAttribute<X,
?> getDeclaredList
(String name) Returns the declared attribute of the given name and of type java.util.List.<E> jakarta.persistence.metamodel.ListAttribute<X,
E> getDeclaredList
(String name, Class<E> elementType) Returns the declared attribute of the given name, of type java.util.List and contains the given element type.jakarta.persistence.metamodel.MapAttribute<X,
?, ?> getDeclaredMap
(String name) Returns the declared attribute of the given name and of type java.util.Map.<K,
V> jakarta.persistence.metamodel.MapAttribute<X, K, V> getDeclaredMap
(String name, Class<K> keyType, Class<V> valueType) Returns the declared attribute of the given name, of type java.util.Map and contains the given key/value type.Return all collection-valued attributes declared by the managed type.jakarta.persistence.metamodel.SetAttribute<X,
?> getDeclaredSet
(String name) Returns the declared attribute of the given name and of type java.util.Set.<E> jakarta.persistence.metamodel.SetAttribute<X,
E> getDeclaredSet
(String name, Class<E> elementType) Returns the declared attribute of the given name, of type java.util.Set and contains the given element type.jakarta.persistence.metamodel.SingularAttribute<X,
?> Returns the declared, single-valued attribute of the given name of any type.<Y> jakarta.persistence.metamodel.SingularAttribute<X,
Y> getDeclaredSingularAttribute
(String name, Class<Y> type) Returns the declared single-valued attribute of the given name and Java type.Returns the single-valued attributes declared by the managed type.<Y> jakarta.persistence.metamodel.SingularAttribute<X,
Y> getDeclaredVersion
(Class<Y> type) Returns the declared attribute of given type that corresponds to the version attribute of this managed type.final <Y> jakarta.persistence.metamodel.SingularAttribute<? super X,
Y> Returns the attribute of given type that corresponds to the id attribute of this identifiable managed type.Returns the attributes corresponding to the id class of the identifiable type.jakarta.persistence.metamodel.ListAttribute<? super X,
?> Returns the attribute of the given name and of type java.util.List.<E> jakarta.persistence.metamodel.ListAttribute<? super X,
E> Returns the attribute of the given name, of type java.util.List and contains the given element type.jakarta.persistence.metamodel.MapAttribute<? super X,
?, ?> Returns the attribute of the given name and of type java.util.Map.<K,
V> jakarta.persistence.metamodel.MapAttribute<? super X, K, V> Returns the attribute of the given name, of type java.util.Map and contains the given key/value type.Returns all collection-valued attributes of the managed type.jakarta.persistence.metamodel.SetAttribute<? super X,
?> Returns the attribute of the given name and of type java.util.Set.<E> jakarta.persistence.metamodel.SetAttribute<? super X,
E> Returns the attribute of the given name, of type java.util.Set and contains the given element type.jakarta.persistence.metamodel.SingularAttribute<? super X,
?> getSingularAttribute
(String name) Returns the single-valued attribute of the given name of any type.<Y> jakarta.persistence.metamodel.SingularAttribute<? super X,
Y> getSingularAttribute
(String name, Class<Y> type) Returns the single-valued attribute of the given name and Java type.Returns the single-valued attributes of the managed type.<Y> jakarta.persistence.metamodel.SingularAttribute<? super X,
Y> getVersion
(Class<Y> type) Returns the attribute of given type that corresponds to the version attribute of this managed type.static <T> T
pick
(Collection<T> original, AbstractManagedType.Filter<T> f1, AbstractManagedType.Filter<T> f2, AbstractManagedType.Filter<T> f3, AbstractManagedType.Filter<T> f4) Applies chain of filters ANDed on the given collection to pick a single element.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface jakarta.persistence.metamodel.Type
getJavaType, getPersistenceType
-
Field Details
-
model
-
meta
-
cls
-
-
Constructor Details
-
AbstractManagedType
A protected constructor for creating psudo-managed types. -
AbstractManagedType
Construct a managed type. The supplied metadata must be resolved i.e. all its fields populated. Because this receiver will populate its attributes corresponding to the available fields of the metadata.
-
-
Method Details
-
getAttributes
Returns all the attributes of the managed type including attributes of the super type.- Specified by:
getAttributes
in interfacejakarta.persistence.metamodel.ManagedType<X>
-
getDeclaredAttributes
Returns all the attributes declared by this managed type only.- Specified by:
getDeclaredAttributes
in interfacejakarta.persistence.metamodel.ManagedType<X>
-
getSingularAttributes
Returns the single-valued attributes of the managed type.- Specified by:
getSingularAttributes
in interfacejakarta.persistence.metamodel.ManagedType<X>
-
getDeclaredSingularAttributes
Returns the single-valued attributes declared by the managed type.- Specified by:
getDeclaredSingularAttributes
in interfacejakarta.persistence.metamodel.ManagedType<X>
-
getAttribute
public <Y> jakarta.persistence.metamodel.Attribute<? super X,Y> getAttribute(String name, Class<Y> type) Returns the attribute of the given name and Java type.- Throws:
IllegalArgumentException
- if no such attribute exists
-
getSingularAttribute
public <Y> jakarta.persistence.metamodel.SingularAttribute<? super X,Y> getSingularAttribute(String name, Class<Y> type) Returns the single-valued attribute of the given name and Java type.- Specified by:
getSingularAttribute
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredAttribute
public <Y> jakarta.persistence.metamodel.Attribute<X,Y> getDeclaredAttribute(String name, Class<Y> type) Returns the declared attribute of the given name and Java type.- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredSingularAttribute
public <Y> jakarta.persistence.metamodel.SingularAttribute<X,Y> getDeclaredSingularAttribute(String name, Class<Y> type) Returns the declared single-valued attribute of the given name and Java type.- Specified by:
getDeclaredSingularAttribute
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getPluralAttributes
Returns all collection-valued attributes of the managed type.- Specified by:
getPluralAttributes
in interfacejakarta.persistence.metamodel.ManagedType<X>
-
getDeclaredPluralAttributes
Return all collection-valued attributes declared by the managed type.- Specified by:
getDeclaredPluralAttributes
in interfacejakarta.persistence.metamodel.ManagedType<X>
-
getCollection
public <E> jakarta.persistence.metamodel.CollectionAttribute<? super X,E> getCollection(String name, Class<E> elementType) Returns the attribute of the given name, of type java.util.Collection and contains the given element type.- Specified by:
getCollection
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getSet
public <E> jakarta.persistence.metamodel.SetAttribute<? super X,E> getSet(String name, Class<E> elementType) Returns the attribute of the given name, of type java.util.Set and contains the given element type.- Specified by:
getSet
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getList
public <E> jakarta.persistence.metamodel.ListAttribute<? super X,E> getList(String name, Class<E> elementType) Returns the attribute of the given name, of type java.util.List and contains the given element type.- Specified by:
getList
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getMap
public <K,V> jakarta.persistence.metamodel.MapAttribute<? super X,K, getMapV> (String name, Class<K> keyType, Class<V> valueType) Returns the attribute of the given name, of type java.util.Map and contains the given key/value type.- Specified by:
getMap
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredCollection
public <E> jakarta.persistence.metamodel.CollectionAttribute<X,E> getDeclaredCollection(String name, Class<E> elementType) Returns the declared attribute of the given name, of type java.util.Collection and contains the given element type.- Specified by:
getDeclaredCollection
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredSet
public <E> jakarta.persistence.metamodel.SetAttribute<X,E> getDeclaredSet(String name, Class<E> elementType) Returns the declared attribute of the given name, of type java.util.Set and contains the given element type.- Specified by:
getDeclaredSet
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredList
public <E> jakarta.persistence.metamodel.ListAttribute<X,E> getDeclaredList(String name, Class<E> elementType) Returns the declared attribute of the given name, of type java.util.List and contains the given element type.- Specified by:
getDeclaredList
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredMap
public <K,V> jakarta.persistence.metamodel.MapAttribute<X,K, getDeclaredMapV> (String name, Class<K> keyType, Class<V> valueType) Returns the declared attribute of the given name, of type java.util.Map and contains the given key/value type.- Specified by:
getDeclaredMap
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getAttribute
Returns the attribute of the given name of any type.- Specified by:
getAttribute
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredAttribute
Returns the declared attribute of the given name of any type.- Specified by:
getDeclaredAttribute
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getSingularAttribute
public jakarta.persistence.metamodel.SingularAttribute<? super X,?> getSingularAttribute(String name) Returns the single-valued attribute of the given name of any type.- Specified by:
getSingularAttribute
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredSingularAttribute
public jakarta.persistence.metamodel.SingularAttribute<X,?> getDeclaredSingularAttribute(String name) Returns the declared, single-valued attribute of the given name of any type.- Specified by:
getDeclaredSingularAttribute
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getCollection
Returns the attribute of the given name and of type java.util.Collection.- Specified by:
getCollection
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getSet
Returns the attribute of the given name and of type java.util.Set.- Specified by:
getSet
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getList
Returns the attribute of the given name and of type java.util.List.- Specified by:
getList
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getMap
Returns the attribute of the given name and of type java.util.Map.- Specified by:
getMap
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredCollection
Returns the declared attribute of the given name and of type java.util.Collection.- Specified by:
getDeclaredCollection
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredSet
Returns the declared attribute of the given name and of type java.util.Set.- Specified by:
getDeclaredSet
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredList
Returns the declared attribute of the given name and of type java.util.List.- Specified by:
getDeclaredList
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredMap
Returns the declared attribute of the given name and of type java.util.Map.- Specified by:
getDeclaredMap
in interfacejakarta.persistence.metamodel.ManagedType<X>
- Throws:
IllegalArgumentException
- if no such attribute exists
-
getIdClassAttributes
public final Set<jakarta.persistence.metamodel.SingularAttribute<? super X,?>> getIdClassAttributes()Returns the attributes corresponding to the id class of the identifiable type.- Throws:
IllegalArgumentException
- if the this type is not using an id class
-
getId
Returns the attribute of given type that corresponds to the id attribute of this identifiable managed type.- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredId
Returns the declared attribute of given type that corresponds to the id attribute of this identifiable managed type.- Throws:
IllegalArgumentException
- if no such attribute exists
-
getVersion
Returns the attribute of given type that corresponds to the version attribute of this managed type.- Throws:
IllegalArgumentException
- if no such attribute exists
-
getDeclaredVersion
Returns the declared attribute of given type that corresponds to the version attribute of this managed type.- Throws:
IllegalArgumentException
- if no such attribute exists
-
filter
public static <T,C extends Collection<E>, C filterE> (Collection<T> original, C result, AbstractManagedType.Filter<T> f1, AbstractManagedType.Filter<T> f2, AbstractManagedType.Filter<T> f3, AbstractManagedType.Filter<T> f4) Applies chain of filters ANDed on the given collection to populate the given result. A null filter evaluates always TRUE. The arguments are not passed as variable argument list to suppress warnings in in the caller for generic varargs array construction. -
pick
public static <T> T pick(Collection<T> original, AbstractManagedType.Filter<T> f1, AbstractManagedType.Filter<T> f2, AbstractManagedType.Filter<T> f3, AbstractManagedType.Filter<T> f4) Applies chain of filters ANDed on the given collection to pick a single element. A null filter evaluates always TRUE. The arguments are not passed as variable argument list to suppress warnings in in the caller for generic varargs array construction. -
getJavaType
- Specified by:
getJavaType
in interfacejakarta.persistence.metamodel.Type<X>
-
toString
-