Class AbstractManagedType<X>
java.lang.Object
org.apache.openjpa.persistence.meta.AbstractManagedType<X>
- Type Parameters:
X- the
- All Implemented Interfaces:
ManagedType<X>, Type<X>
- Direct Known Subclasses:
Types.Embeddable, Types.Identifiable, Types.PseudoEntity
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
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classSelects if the attribute type matches the given Java class. null matches any type.static final classstatic final classSelects plural attribute of given element type. null element type imply any element type.static final classstatic interfaceAffirms if a given element satisfy a condition.static final classstatic final classstatic final classAffirms if the given attribute is a Singular attribute.static final classNested classes/interfaces inherited from interface Type
Type.PersistenceType -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractManagedType(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.getAttribute(String name) Returns the attribute of the given name of any type.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.CollectionAttribute<? super X, ?> getCollection(String name) Returns the attribute of the given name and of type java.util.Collection.<E> 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.getDeclaredAttribute(String name) Returns the declared attribute of the given name of any type.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.getDeclaredCollection(String name) Returns the declared attribute of the given name and of type java.util.Collection.<E> 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> 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.ListAttribute<X, ?> getDeclaredList(String name) Returns the declared attribute of the given name and of type java.util.List.<E> 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.MapAttribute<X, ?, ?> getDeclaredMap(String name) Returns the declared attribute of the given name and of type java.util.Map.<K,V> 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.Set<PluralAttribute<X, ?, ?>> Return all collection-valued attributes declared by the managed type.SetAttribute<X, ?> getDeclaredSet(String name) Returns the declared attribute of the given name and of type java.util.Set.<E> 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.Returns the declared, single-valued attribute of the given name of any type.<Y> SingularAttribute<X, Y> getDeclaredSingularAttribute(String name, Class<Y> type) Returns the declared single-valued attribute of the given name and Java type.Set<SingularAttribute<X, ?>> Returns the single-valued attributes declared by the managed type.<Y> 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> SingularAttribute<? super X, Y> Returns the attribute of given type that corresponds to the id attribute of this identifiable managed type.final Set<SingularAttribute<? super X, ?>> Returns the attributes corresponding to the id class of the identifiable type.ListAttribute<? super X, ?> Returns the attribute of the given name and of type java.util.List.<E> ListAttribute<? super X, E> Returns the attribute of the given name, of type java.util.List and contains the given element type.MapAttribute<? super X, ?, ?> Returns the attribute of the given name and of type java.util.Map.<K,V> MapAttribute <? super X, K, V> Returns the attribute of the given name, of type java.util.Map and contains the given key/value type.Set<PluralAttribute<? super X, ?, ?>> Returns all collection-valued attributes of the managed type.SetAttribute<? super X, ?> Returns the attribute of the given name and of type java.util.Set.<E> SetAttribute<? super X, E> Returns the attribute of the given name, of type java.util.Set and contains the given element type.SingularAttribute<? super X, ?> getSingularAttribute(String name) Returns the single-valued attribute of the given name of any type.<Y> SingularAttribute<? super X, Y> getSingularAttribute(String name, Class<Y> type) Returns the single-valued attribute of the given name and Java type.Set<SingularAttribute<? super X, ?>> Returns the single-valued attributes of the managed type.<Y> 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> Tpick(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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface 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:
getAttributesin interfaceManagedType<X>
-
getDeclaredAttributes
Returns all the attributes declared by this managed type only.- Specified by:
getDeclaredAttributesin interfaceManagedType<X>
-
getSingularAttributes
Returns the single-valued attributes of the managed type.- Specified by:
getSingularAttributesin interfaceManagedType<X>
-
getDeclaredSingularAttributes
Returns the single-valued attributes declared by the managed type.- Specified by:
getDeclaredSingularAttributesin interfaceManagedType<X>
-
getAttribute
Returns the attribute of the given name and Java type.- Throws:
IllegalArgumentException- if no such attribute exists
-
getSingularAttribute
Returns the single-valued attribute of the given name and Java type.- Specified by:
getSingularAttributein interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getDeclaredAttribute
Returns the declared attribute of the given name and Java type.- Throws:
IllegalArgumentException- if no such attribute exists
-
getDeclaredSingularAttribute
Returns the declared single-valued attribute of the given name and Java type.- Specified by:
getDeclaredSingularAttributein interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getPluralAttributes
Returns all collection-valued attributes of the managed type.- Specified by:
getPluralAttributesin interfaceManagedType<X>
-
getDeclaredPluralAttributes
Return all collection-valued attributes declared by the managed type.- Specified by:
getDeclaredPluralAttributesin interfaceManagedType<X>
-
getCollection
Returns the attribute of the given name, of type java.util.Collection and contains the given element type.- Specified by:
getCollectionin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getSet
Returns the attribute of the given name, of type java.util.Set and contains the given element type.- Specified by:
getSetin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getList
Returns the attribute of the given name, of type java.util.List and contains the given element type.- Specified by:
getListin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getMap
public <K,V> MapAttribute<? super X, K, V> getMap(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:
getMapin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getDeclaredCollection
Returns the declared attribute of the given name, of type java.util.Collection and contains the given element type.- Specified by:
getDeclaredCollectionin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getDeclaredSet
Returns the declared attribute of the given name, of type java.util.Set and contains the given element type.- Specified by:
getDeclaredSetin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getDeclaredList
Returns the declared attribute of the given name, of type java.util.List and contains the given element type.- Specified by:
getDeclaredListin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getDeclaredMap
Returns the declared attribute of the given name, of type java.util.Map and contains the given key/value type.- Specified by:
getDeclaredMapin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getAttribute
Returns the attribute of the given name of any type.- Specified by:
getAttributein interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getDeclaredAttribute
Returns the declared attribute of the given name of any type.- Specified by:
getDeclaredAttributein interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getSingularAttribute
Returns the single-valued attribute of the given name of any type.- Specified by:
getSingularAttributein interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getDeclaredSingularAttribute
Returns the declared, single-valued attribute of the given name of any type.- Specified by:
getDeclaredSingularAttributein interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getCollection
Returns the attribute of the given name and of type java.util.Collection.- Specified by:
getCollectionin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getSet
Returns the attribute of the given name and of type java.util.Set.- Specified by:
getSetin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getList
Returns the attribute of the given name and of type java.util.List.- Specified by:
getListin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
getMap
Returns the attribute of the given name and of type java.util.Map.- Specified by:
getMapin interfaceManagedType<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:
getDeclaredCollectionin interfaceManagedType<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:
getDeclaredSetin interfaceManagedType<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:
getDeclaredListin interfaceManagedType<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:
getDeclaredMapin interfaceManagedType<X>- Throws:
IllegalArgumentException- if no such attribute exists
-
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>, E> C filter(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:
getJavaTypein interfaceType<X>
-
toString
-