Top Description Methods
javax.persistence.metamodel

public Interface ManagedType<X>

extends Type<X>
Known Direct Subinterfaces
javax.persistence.metamodel.EmbeddableType, javax.persistence.metamodel.IdentifiableType
Type Parameters
<X>
The represented type.
Imports
java.util.Set

Instances of the type ManagedType represent entity, mapped superclass, and embeddable types.
Since
Java Persistence 2.0

Method Summary

Modifier and TypeMethod and Description
public Attribute<? super X, ?>

Returns:

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

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

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

Returns:

attributes of the managed type
getAttributes
()

Return the attributes of the managed type.

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
)

Return the Collection-valued attribute of the managed type that corresponds to the specified name and Java element type.

public CollectionAttribute<? super X, ?>

Returns:

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

Return the Collection-valued 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
)

Return the attribute declared by the managed type that corresponds to the specified name.

public Set<Attribute<X, ?>>

Returns:

declared attributes of the managed type
getDeclaredAttributes
()

Return the attributes declared by the managed type.

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
)

Return the Collection-valued attribute declared by the managed type that corresponds to the specified name and Java element type.

public CollectionAttribute<X, ?>

Returns:

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

Return the Collection-valued attribute declared by the managed type that corresponds to the specified name.

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
)

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
)

Return the List-valued attribute declared by the managed type that corresponds to the specified name.

public <K, V> MapAttribute<X, K, V>

Returns:

declared 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
)

Return the Map-valued attribute declared by the managed type that corresponds to the specified name and Java key and value types.

public MapAttribute<X, ?, ?>

Returns:

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

Return the Map-valued attribute declared by the managed type that corresponds to the specified name.

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

Returns:

declared Collection-, Set-, List-, and Map-valued attributes
getDeclaredPluralAttributes
()

Return all multi-valued attributes (Collection-, Set-, List-, and Map-valued attributes) declared by the managed type.

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
)

Return the Set-valued attribute declared by the managed type that corresponds to the specified name and Java element type.

public SetAttribute<X, ?>

Returns:

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

Return the Set-valued attribute declared by the managed type that corresponds to the specified name.

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
)

Return the single-valued attribute declared by the managed type that corresponds to the specified name and Java type.

public SingularAttribute<X, ?>

Returns:

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

Return the single-valued attribute declared by the managed type that corresponds to the specified name.

public Set<SingularAttribute<X, ?>>

Returns:

declared single-valued attributes
getDeclaredSingularAttributes
()

Return the single-valued attributes declared by the managed type.

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
)

Return the List-valued attribute of the managed type that corresponds to the specified name and Java element type.

public ListAttribute<? super X, ?>

Returns:

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

Return the List-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
)

Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types.

public MapAttribute<? super X, ?, ?>

Returns:

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

Return the Map-valued attribute of the managed type that corresponds to the specified name.

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

Returns:

Collection-, Set-, List-, and Map-valued attributes
getPluralAttributes
()

Return all multi-valued attributes (Collection-, Set-, List-, and Map-valued attributes) of the managed type.

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
)

Return the Set-valued attribute of the managed type that corresponds to the specified name and Java element type.

public SetAttribute<? super X, ?>

Returns:

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

Return the Set-valued attribute of the managed type that corresponds to the specified name.

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
)

Return the single-valued attribute of the managed type that corresponds to the specified name and Java type.

public SingularAttribute<? super X, ?>

Returns:

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

Return the single-valued attribute of the managed type that corresponds to the specified name.

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

Returns:

single-valued attributes
getSingularAttributes
()

Return the single-valued attributes of the managed type.

Inherited from javax.persistence.metamodel.Type:
getJavaTypegetPersistenceType

Method Detail

getAttributeback to summary
public Attribute<? super X, ?> getAttribute(String name)

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

Parameters
name:String

the name of the represented attribute

Returns:Attribute<? super X, ?>

attribute with given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not present in the managed type
getAttributesback to summary
public Set<Attribute<? super X, ?>> getAttributes()

Return the attributes of the managed type.

Returns:Set<Attribute<? super X, ?>>

attributes of the managed type

getCollectionback to summary
public <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.

Parameters
name:String

the name of the represented attribute

elementType:Class<E>

the element type of the represented attribute

Returns:CollectionAttribute<? super X, E>

CollectionAttribute of the given name and element type

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not present in the managed type
getCollectionback to summary
public CollectionAttribute<? super X, ?> getCollection(String name)

Return the Collection-valued attribute of the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:CollectionAttribute<? super X, ?>

CollectionAttribute of the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not present in the managed type
getDeclaredAttributeback to summary
public Attribute<X, ?> getDeclaredAttribute(String name)

Return the attribute declared by the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:Attribute<X, ?>

attribute with given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not declared in the managed type
getDeclaredAttributesback to summary
public Set<Attribute<X, ?>> getDeclaredAttributes()

Return the attributes declared by the managed type. Returns empty set if the managed type has no declared attributes.

Returns:Set<Attribute<X, ?>>

declared attributes of the managed type

getDeclaredCollectionback to summary
public <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.

Parameters
name:String

the name of the represented attribute

elementType:Class<E>

the element type of the represented attribute

Returns:CollectionAttribute<X, E>

declared CollectionAttribute of the given name and element type

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not declared in the managed type
getDeclaredCollectionback to summary
public CollectionAttribute<X, ?> getDeclaredCollection(String name)

Return the Collection-valued attribute declared by the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:CollectionAttribute<X, ?>

declared CollectionAttribute of the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not declared in the managed type
getDeclaredListback to summary
public <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.

Parameters
name:String

the name of the represented attribute

elementType:Class<E>

the element type of the represented attribute

Returns:ListAttribute<X, E>

declared ListAttribute of the given name and element type

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not declared in the managed type
getDeclaredListback to summary
public ListAttribute<X, ?> getDeclaredList(String name)

Return the List-valued attribute declared by the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:ListAttribute<X, ?>

declared ListAttribute of the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not declared in the managed type
getDeclaredMapback to summary
public <K, V> MapAttribute<X, K, V> getDeclaredMap(String name, Class<K> keyType, 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:String

the name of the represented attribute

keyType:Class<K>

the key type of the represented attribute

valueType:Class<V>

the value type of the represented attribute

Returns:MapAttribute<X, K, V>

declared MapAttribute of the given name and key and value types

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not declared in the managed type
getDeclaredMapback to summary
public MapAttribute<X, ?, ?> getDeclaredMap(String name)

Return the Map-valued attribute declared by the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:MapAttribute<X, ?, ?>

declared MapAttribute of the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not declared in the managed type
getDeclaredPluralAttributesback to summary
public 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:Set<PluralAttribute<X, ?, ?>>

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

getDeclaredSetback to summary
public <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.

Parameters
name:String

the name of the represented attribute

elementType:Class<E>

the element type of the represented attribute

Returns:SetAttribute<X, E>

declared SetAttribute of the given name and element type

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not declared in the managed type
getDeclaredSetback to summary
public SetAttribute<X, ?> getDeclaredSet(String name)

Return the Set-valued attribute declared by the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:SetAttribute<X, ?>

declared SetAttribute of the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not declared in the managed type
getDeclaredSingularAttributeback to summary
public <Y> SingularAttribute<X, Y> getDeclaredSingularAttribute(String name, Class<Y> type)

Return the single-valued attribute declared by the managed type that corresponds to the specified name and Java type.

Parameters
name:String

the name of the represented attribute

type:Class<Y>

the type of the represented attribute

Returns:SingularAttribute<X, Y>

declared single-valued attribute of the given name and type

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not declared in the managed type
getDeclaredSingularAttributeback to summary
public SingularAttribute<X, ?> getDeclaredSingularAttribute(String name)

Return the single-valued attribute declared by the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:SingularAttribute<X, ?>

declared single-valued attribute of the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not declared in the managed type
getDeclaredSingularAttributesback to summary
public 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:Set<SingularAttribute<X, ?>>

declared single-valued attributes

getListback to summary
public <E> ListAttribute<? super X, E> getList(String name, Class<E> elementType)

Return the List-valued attribute of the managed type that corresponds to the specified name and Java element type.

Parameters
name:String

the name of the represented attribute

elementType:Class<E>

the element type of the represented attribute

Returns:ListAttribute<? super X, E>

ListAttribute of the given name and element type

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not present in the managed type
getListback to summary
public ListAttribute<? super X, ?> getList(String name)

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

Parameters
name:String

the name of the represented attribute

Returns:ListAttribute<? super X, ?>

ListAttribute of the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not present in the managed type
getMapback to summary
public <K, V> MapAttribute<? super X, K, V> getMap(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.

Parameters
name:String

the name of the represented attribute

keyType:Class<K>

the key type of the represented attribute

valueType:Class<V>

the value type of the represented attribute

Returns:MapAttribute<? super X, K, V>

MapAttribute of the given name and key and value types

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not present in the managed type
getMapback to summary
public MapAttribute<? super X, ?, ?> getMap(String name)

Return the Map-valued attribute of the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:MapAttribute<? super X, ?, ?>

MapAttribute of the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not present in the managed type
getPluralAttributesback to summary
public 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:Set<PluralAttribute<? super X, ?, ?>>

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

getSetback to summary
public <E> SetAttribute<? super X, E> getSet(String name, Class<E> elementType)

Return the Set-valued attribute of the managed type that corresponds to the specified name and Java element type.

Parameters
name:String

the name of the represented attribute

elementType:Class<E>

the element type of the represented attribute

Returns:SetAttribute<? super X, E>

SetAttribute of the given name and element type

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not present in the managed type
getSetback to summary
public SetAttribute<? super X, ?> getSet(String name)

Return the Set-valued attribute of the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:SetAttribute<? super X, ?>

SetAttribute of the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not present in the managed type
getSingularAttributeback to summary
public <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.

Parameters
name:String

the name of the represented attribute

type:Class<Y>

the type of the represented attribute

Returns:SingularAttribute<? super X, Y>

single-valued attribute with given name and type

Exceptions
IllegalArgumentException:
if attribute of the given name and type is not present in the managed type
getSingularAttributeback to summary
public SingularAttribute<? super X, ?> getSingularAttribute(String name)

Return the single-valued attribute of the managed type that corresponds to the specified name.

Parameters
name:String

the name of the represented attribute

Returns:SingularAttribute<? super X, ?>

single-valued attribute with the given name

Exceptions
IllegalArgumentException:
if attribute of the given name is not present in the managed type
getSingularAttributesback to summary
public 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:Set<SingularAttribute<? super X, ?>>

single-valued attributes