T
- type of data model classpublic class DefaultDataModelDefinition<T> extends Object implements DataModelDefinition<T>
DataModelDefinition
.DefaultDataModelAdapter
DataModelDefinition.Builder<T>
Constructor and Description |
---|
DefaultDataModelDefinition(Class<T> modelClass)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
<A extends Annotation> |
getAnnotation(Class<A> annotationType)
Returns this element's annotation for the specified annotation type.
|
<A extends Annotation> |
getAnnotation(PropertyName name,
Class<A> annotationType)
Returns the property's annotation for the specified annotation type.
|
Class<T> |
getModelClass()
Returns the corresponded data model class.
|
Collection<PropertyName> |
getProperties()
returns the all public property names.
|
PropertyType |
getType(PropertyName name)
Returns the property type.
|
DataModelDefinition.Builder<T> |
newReflection()
Starts to build a new
DataModelReflection . |
Object |
resolveRawValue(Object value)
Converts the given raw property value into a corresponded property value for
DataModelReflection . |
T |
toObject(DataModelReflection reflection)
Converts a generic reflection model into a target object.
|
DataModelReflection |
toReflection(T object)
Converts a target object into a generic reflection model.
|
public DefaultDataModelDefinition(Class<T> modelClass)
modelClass
- the original model classIllegalArgumentException
- if some parameters were null
public Class<T> getModelClass()
DataModelDefinition
getModelClass
in interface DataModelDefinition<T>
public <A extends Annotation> A getAnnotation(Class<A> annotationType)
DataModelDefinition
getAnnotation
in interface DataModelDefinition<T>
A
- type of annotationannotationType
- class of annotationnull
if does not presentpublic Collection<PropertyName> getProperties()
DataModelDefinition
getProperties
in interface DataModelDefinition<T>
public PropertyType getType(PropertyName name)
DataModelDefinition
getType
in interface DataModelDefinition<T>
name
- the property namenull
if no such property existspublic <A extends Annotation> A getAnnotation(PropertyName name, Class<A> annotationType)
DataModelDefinition
getAnnotation
in interface DataModelDefinition<T>
A
- type of annotationname
- target propertyannotationType
- class of annotationnull
if neither the property nor its specified annotation do not presentpublic DataModelDefinition.Builder<T> newReflection()
DataModelDefinition
DataModelReflection
.newReflection
in interface DataModelDefinition<T>
public DataModelReflection toReflection(T object)
DataModelDefinition
toReflection
in interface DataModelDefinition<T>
object
- target objectpublic T toObject(DataModelReflection reflection)
DataModelDefinition
toObject
in interface DataModelDefinition<T>
reflection
- a reflection modelpublic Object resolveRawValue(Object value)
DataModelDefinition
DataModelReflection
.resolveRawValue
in interface DataModelDefinition<T>
value
- the raw property valueCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.