T
- type of data modelpublic class SimpleDataModelDefinition<T> extends Object implements DataModelDefinition<T>
DataModelDefinition
for classes which declare public fields directly.
This supports only following types:
String
, BigInteger
, BigDecimal
, Calendar
Additionaly, each field should be named in camelCase
.
DataModelDefinition.Builder<T>
Constructor and Description |
---|
SimpleDataModelDefinition(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.
|
static PropertyType |
getType(PropertyName name,
Class<?> type)
Returns property type kind corresponded to the property name and type.
|
DataModelDefinition.Builder<T> |
newReflection()
Starts to build a new
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
resolveRawValue
public SimpleDataModelDefinition(Class<T> modelClass)
modelClass
- target 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 static PropertyType getType(PropertyName name, Class<?> type)
name
- property nametype
- property typenull
without suitable corresponded kindIllegalArgumentException
- if some parameters were null
public <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 modelCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.