javax.persistence.metamodel
Interface ManagedType<X>

Type Parameters:
X - The represented type.
All Superinterfaces:
Type<X>
All Known Subinterfaces:
EmbeddableType<X>, EntityType<X>, IdentifiableType<X>, MappedSuperclassType<X>

public interface ManagedType<X>
extends Type<X>

Instances of the type ManagedType represent entity, mapped superclass, and embeddable types.

Since:
Java Persistence 2.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.persistence.metamodel.Type
Type.PersistenceType
 
Method Summary
 Attribute<? super X,?> getAttribute(java.lang.String name)
          Return the attribute of the managed type that corresponds to the specified name.
 java.util.Set<Attribute<? super X,?>> getAttributes()
          Return the attributes of the managed type.
 CollectionAttribute<? super X,?> getCollection(java.lang.String name)
          Return the Collection-valued attribute of the managed type that corresponds to the specified name.
<E> CollectionAttribute<? super X,E>
getCollection(java.lang.String name, java.lang.Class<E> elementType)
          Return the Collection-valued attribute of the managed type that corresponds to the specified name and Java element type.
 Attribute<X,?> getDeclaredAttribute(java.lang.String name)
          Return the attribute declared by the managed type that corresponds to the specified name.
 java.util.Set<Attribute<X,?>> getDeclaredAttributes()
          Return the attributes declared by the managed type.
 CollectionAttribute<X,?> getDeclaredCollection(java.lang.String name)
          Return the Collection-valued attribute declared by the managed type that corresponds to the specified name.
<E> CollectionAttribute<X,E>
getDeclaredCollection(java.lang.String name, java.lang.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(java.lang.String name)
          Return the List-valued attribute declared by the managed type that corresponds to the specified name.
<E> ListAttribute<X,E>
getDeclaredList(java.lang.String name, java.lang.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(java.lang.String name)
          Return the Map-valued attribute declared by the managed type that corresponds to the specified name.
<K,V> MapAttribute<X,K,V>
getDeclaredMap(java.lang.String name, java.lang.Class<K> keyType, java.lang.Class<V> valueType)
          Return the Map-valued attribute declared by the managed type that corresponds to the specified name and Java key and value types.
 java.util.Set<PluralAttribute<X,?,?>> getDeclaredPluralAttributes()
          Return all multi-valued attributes (Collection-, Set-, List-, and Map-valued attributes) declared by the managed type.
 SetAttribute<X,?> getDeclaredSet(java.lang.String name)
          Return the Set-valued attribute declared by the managed type that corresponds to the specified name.
<E> SetAttribute<X,E>
getDeclaredSet(java.lang.String name, java.lang.Class<E> elementType)
          Return the Set-valued attribute declared by the managed type that corresponds to the specified name and Java element type.
 SingularAttribute<X,?> getDeclaredSingularAttribute(java.lang.String name)
          Return the single-valued attribute declared by the managed type that corresponds to the specified name.
<Y> SingularAttribute<X,Y>
getDeclaredSingularAttribute(java.lang.String name, java.lang.Class<Y> type)
          Return the single-valued attribute declared by the managed type that corresponds to the specified name and Java type.
 java.util.Set<SingularAttribute<X,?>> getDeclaredSingularAttributes()
          Return the single-valued attributes declared by the managed type.
 ListAttribute<? super X,?> getList(java.lang.String name)
          Return the List-valued attribute of the managed type that corresponds to the specified name.
<E> ListAttribute<? super X,E>
getList(java.lang.String name, java.lang.Class<E> elementType)
          Return the List-valued attribute of the managed type that corresponds to the specified name and Java element type.
 MapAttribute<? super X,?,?> getMap(java.lang.String name)
          Return the Map-valued attribute of the managed type that corresponds to the specified name.
<K,V> MapAttribute<? super X,K,V>
getMap(java.lang.String name, java.lang.Class<K> keyType, java.lang.Class<V> valueType)
          Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types.
 java.util.Set<PluralAttribute<? super X,?,?>> getPluralAttributes()
          Return all multi-valued attributes (Collection-, Set-, List-, and Map-valued attributes) of the managed type.
 SetAttribute<? super X,?> getSet(java.lang.String name)
          Return the Set-valued attribute of the managed type that corresponds to the specified name.
<E> SetAttribute<? super X,E>
getSet(java.lang.String name, java.lang.Class<E> elementType)
          Return the Set-valued attribute of the managed type that corresponds to the specified name and Java element type.
 SingularAttribute<? super X,?> getSingularAttribute(java.lang.String name)
          Return the single-valued attribute of the managed type that corresponds to the specified name.
<Y> SingularAttribute<? super X,Y>
getSingularAttribute(java.lang.String name, java.lang.Class<Y> type)
          Return the single-valued attribute of the managed type that corresponds to the specified name and Java type.
 java.util.Set<SingularAttribute<? super X,?>> getSingularAttributes()
          Return the single-valued attributes of the managed type.
 
Methods inherited from interface javax.persistence.metamodel.Type
getJavaType, getPersistenceType
 

Method Detail

getAttributes

java.util.Set<Attribute<? super X,?>> getAttributes()
Return the attributes of the managed type.

Returns:
attributes of the managed type

getDeclaredAttributes

java.util.Set<Attribute<X,?>> getDeclaredAttributes()
Return the attributes declared by the managed type. Returns empty set if the managed type has no declared attributes.

Returns:
declared attributes of the managed type

getSingularAttribute

<Y> SingularAttribute<? super X,Y> getSingularAttribute(java.lang.String name,
                                                        java.lang.Class<Y> type)
Return the single-valued attribute of the managed type that corresponds to the specified name and Java type.

Parameters:
name - the name of the represented attribute
type - 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

getDeclaredSingularAttribute

<Y> SingularAttribute<X,Y> getDeclaredSingularAttribute(java.lang.String name,
                                                        java.lang.Class<Y> type)
Return the single-valued attribute declared by the managed type that corresponds to the specified name and Java type.

Parameters:
name - the name of the represented attribute
type - 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

getSingularAttributes

java.util.Set<SingularAttribute<? super X,?>> getSingularAttributes()
Return the single-valued attributes of the managed type. Returns empty set if the managed type has no single-valued attributes.

Returns:
single-valued attributes

getDeclaredSingularAttributes

java.util.Set<SingularAttribute<X,?>> getDeclaredSingularAttributes()
Return the single-valued attributes declared by the managed type. Returns empty set if the managed type has no declared single-valued attributes.

Returns:
declared single-valued attributes

getCollection

<E> CollectionAttribute<? super X,E> getCollection(java.lang.String name,
                                                   java.lang.Class<E> elementType)
Return the Collection-valued attribute of the managed type that corresponds to the specified name and Java element type.

Parameters:
name - the name of the represented attribute
elementType - 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

getDeclaredCollection

<E> CollectionAttribute<X,E> getDeclaredCollection(java.lang.String name,
                                                   java.lang.Class<E> elementType)
Return the Collection-valued attribute declared by the managed type that corresponds to the specified name and Java element type.

Parameters:
name - the name of the represented attribute
elementType - 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

getSet

<E> SetAttribute<? super X,E> getSet(java.lang.String name,
                                     java.lang.Class<E> elementType)
Return the Set-valued attribute of the managed type that corresponds to the specified name and Java element type.

Parameters:
name - the name of the represented attribute
elementType - 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

getDeclaredSet

<E> SetAttribute<X,E> getDeclaredSet(java.lang.String name,
                                     java.lang.Class<E> elementType)
Return the Set-valued attribute declared by the managed type that corresponds to the specified name and Java element type.

Parameters:
name - the name of the represented attribute
elementType - 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

getList

<E> ListAttribute<? super X,E> getList(java.lang.String name,
                                       java.lang.Class<E> elementType)
Return the List-valued attribute of the managed type that corresponds to the specified name and Java element type.

Parameters:
name - the name of the represented attribute
elementType - 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

getDeclaredList

<E> ListAttribute<X,E> getDeclaredList(java.lang.String name,
                                       java.lang.Class<E> elementType)
Return the List-valued attribute declared by the managed type that corresponds to the specified name and Java element type.

Parameters:
name - the name of the represented attribute
elementType - 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

getMap

<K,V> MapAttribute<? super X,K,V> getMap(java.lang.String name,
                                         java.lang.Class<K> keyType,
                                         java.lang.Class<V> valueType)
Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types.

Parameters:
name - the name of the represented attribute
keyType - the key type of the represented attribute
valueType - 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

getDeclaredMap

<K,V> MapAttribute<X,K,V> getDeclaredMap(java.lang.String name,
                                         java.lang.Class<K> keyType,
                                         java.lang.Class<V> valueType)
Return the Map-valued attribute declared by the managed type that corresponds to the specified name and Java key and value types.

Parameters:
name - the name of the represented attribute
keyType - the key type of the represented attribute
valueType - the value type of the represented attribute
Returns:
declared MapAttribute of the given name and key and value types
Throws:
IllegalArgumentException - if attribute of the given name and type is not declared in the managed type

getPluralAttributes

java.util.Set<PluralAttribute<? super X,?,?>> getPluralAttributes()
Return all multi-valued attributes (Collection-, Set-, List-, and Map-valued attributes) of the managed type. Returns empty set if the managed type has no multi-valued attributes.

Returns:
Collection-, Set-, List-, and Map-valued attributes

getDeclaredPluralAttributes

java.util.Set<PluralAttribute<X,?,?>> getDeclaredPluralAttributes()
Return all multi-valued attributes (Collection-, Set-, List-, and Map-valued attributes) declared by the managed type. Returns empty set if the managed type has no declared multi-valued attributes.

Returns:
declared Collection-, Set-, List-, and Map-valued attributes

getAttribute

Attribute<? super X,?> getAttribute(java.lang.String name)
Return the attribute of the managed type that corresponds to the specified name.

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

getDeclaredAttribute

Attribute<X,?> getDeclaredAttribute(java.lang.String name)
Return the attribute declared by the managed type that corresponds to the specified name.

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

getSingularAttribute

SingularAttribute<? super X,?> getSingularAttribute(java.lang.String name)
Return the single-valued attribute of the managed type that corresponds to the specified name.

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

getDeclaredSingularAttribute

SingularAttribute<X,?> getDeclaredSingularAttribute(java.lang.String name)
Return the single-valued attribute declared by the managed type that corresponds to the specified name.

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

getCollection

CollectionAttribute<? super X,?> getCollection(java.lang.String name)
Return the Collection-valued attribute of the managed type that corresponds to the specified name.

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

getDeclaredCollection

CollectionAttribute<X,?> getDeclaredCollection(java.lang.String name)
Return the Collection-valued attribute declared by the managed type that corresponds to the specified name.

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

getSet

SetAttribute<? super X,?> getSet(java.lang.String name)
Return the Set-valued attribute of the managed type that corresponds to the specified name.

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

getDeclaredSet

SetAttribute<X,?> getDeclaredSet(java.lang.String name)
Return the Set-valued attribute declared by the managed type that corresponds to the specified name.

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

getList

ListAttribute<? super X,?> getList(java.lang.String name)
Return the List-valued attribute of the managed type that corresponds to the specified name.

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

getDeclaredList

ListAttribute<X,?> getDeclaredList(java.lang.String name)
Return the List-valued attribute declared by the managed type that corresponds to the specified name.

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

getMap

MapAttribute<? super X,?,?> getMap(java.lang.String name)
Return the Map-valued attribute of the managed type that corresponds to the specified name.

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

MapAttribute<X,?,?> getDeclaredMap(java.lang.String name)
Return the Map-valued attribute declared by the managed type that corresponds to the specified name.

Parameters:
name - the name of the represented attribute
Returns:
declared MapAttribute of the given name
Throws:
IllegalArgumentException - if attribute of the given name is not declared in the managed type


Submit a bug or feature

Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 10-February-2011 12:41