public class JpaAttributeMetadata extends java.lang.Object implements AttributeMetadata
AttributeMetadata
for JPA.Constructor and Description |
---|
JpaAttributeMetadata(javax.persistence.metamodel.EntityType<?> entityType,
javax.persistence.metamodel.Attribute attribute) |
Modifier and Type | Method and Description |
---|---|
<A extends java.lang.annotation.Annotation> |
annotation(java.lang.Class<A> annoType)
Get the given annotation.
|
java.util.Collection<?> |
asCollection(java.lang.Object target)
Get the path of this attribute as a
Collection . |
java.util.Map |
asMap(java.lang.Object target)
Get the path of this attribute as a
Map . |
java.util.Set<?> |
asSet(java.lang.Object target)
Get the path of this attribute as a
Set . |
java.lang.Class<?> |
elementType()
The element type of this attribute, if this attribute is a "plural"-like attribute (a Collection, Map, etc...).
|
java.lang.Object |
get(java.lang.Object target)
Get the path of this attribute.
|
boolean |
hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annoType)
Does this attribute have the given annotation on it?
|
boolean |
isCollectionLike()
Can this attribute look like a
Collection ? |
boolean |
isMapLike()
Can this attribute look like a
Map ? |
boolean |
isNullable()
Whether this attribute can be nulled or not.
|
boolean |
isSetLike()
Can this attribute look like a
Set ? |
java.lang.Class<?> |
keyType()
The type of this map's key, if it's map-like.
|
java.lang.String |
name()
Name of the attribute.
|
AttributeMetadata |
set(java.lang.Object value,
java.lang.Object target)
Set the path of this attribute.
|
java.lang.String |
toString() |
java.lang.Class<?> |
type()
The type of this attribute.
|
public JpaAttributeMetadata(javax.persistence.metamodel.EntityType<?> entityType, javax.persistence.metamodel.Attribute attribute)
public java.lang.String name()
AttributeMetadata
name
in interface AttributeMetadata
public java.lang.Class<?> type()
AttributeMetadata
type
in interface AttributeMetadata
public java.lang.Class<?> keyType()
AttributeMetadata
keyType
in interface AttributeMetadata
public java.lang.Class<?> elementType()
AttributeMetadata
elementType
in interface AttributeMetadata
public boolean isNullable()
AttributeMetadata
isNullable
in interface AttributeMetadata
public boolean isCollectionLike()
AttributeMetadata
Collection
?isCollectionLike
in interface AttributeMetadata
public java.util.Collection<?> asCollection(java.lang.Object target)
AttributeMetadata
Collection
.asCollection
in interface AttributeMetadata
target
- The entity to inspect for this attribute.Collection
public boolean isSetLike()
AttributeMetadata
Set
?isSetLike
in interface AttributeMetadata
public java.util.Set<?> asSet(java.lang.Object target)
AttributeMetadata
Set
.asSet
in interface AttributeMetadata
target
- The entity to inspect for this attribute.Set
public boolean isMapLike()
AttributeMetadata
Map
?isMapLike
in interface AttributeMetadata
public java.util.Map asMap(java.lang.Object target)
AttributeMetadata
Map
.asMap
in interface AttributeMetadata
target
- The entity to inspect for this attribute.Map
public boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annoType)
AttributeMetadata
hasAnnotation
in interface AttributeMetadata
annoType
- The type of annotation to search for.public <A extends java.lang.annotation.Annotation> A annotation(java.lang.Class<A> annoType)
AttributeMetadata
annotation
in interface AttributeMetadata
annoType
- The type of annotation to get.public java.lang.Object get(java.lang.Object target)
AttributeMetadata
get
in interface AttributeMetadata
target
- The entity to inspect for this attribute.public AttributeMetadata set(java.lang.Object value, java.lang.Object target)
AttributeMetadata
set
in interface AttributeMetadata
value
- Value to set on this attribute.target
- The entity to set this attribute's value on.public java.lang.String toString()
toString
in class java.lang.Object