public abstract class AbstractRuntimeObjectModel extends Object implements RuntimeObjectModel
RuntimeObjectModel
.Modifier and Type | Field and Description |
---|---|
static Set<Class<?>> |
PRIMITIVE_CLASSES
A
Set that stores all the supported primitive classes. |
static String |
TO_STRING_METHOD |
Constructor and Description |
---|
AbstractRuntimeObjectModel() |
Modifier and Type | Method and Description |
---|---|
protected String |
collectionToString(Collection<?> col) |
protected Method |
extractMethodInheritanceChain(Class type,
Method m) |
protected static Method |
findMethod(Class<?> cls,
String baseName) |
protected Collection<Object> |
fromIterator(Iterator<Object> iterator) |
protected Method |
getClassMethod(Class<?> clazz,
Method m) |
protected static Object |
getField(Object obj,
String property) |
protected Object |
getIndex(Object obj,
int index) |
protected Object |
getIndexSafe(List list,
int index) |
protected Object |
getMapProperty(Map map,
String property) |
protected Object |
getObjectNoArgMethod(Object obj,
String property) |
protected Object |
getObjectProperty(Object obj,
String property) |
protected Object |
getProperty(Object target,
Object propertyObj) |
boolean |
isCollection(Object target)
Checks if an object is a
Collection or is backed by one. |
boolean |
isDate(Object target)
Checks if the provided object represents a date or calendar.
|
protected static boolean |
isMethodAllowed(Method method) |
boolean |
isNumber(Object target)
Checks if the provided object represents a number or not.
|
boolean |
isPrimitive(Object obj)
Checks if the provided object represents a primitive data type or not.
|
protected String |
objectToString(Object obj) |
protected Collection<Object> |
obtainCollection(Object obj) |
Object |
resolveProperty(Object target,
Object property)
Resolve a property of a target object and return its value.
|
boolean |
toBoolean(Object object)
Convert the given object to a boolean value
|
protected boolean |
toBooleanInternal(Object obj) |
Collection<Object> |
toCollection(Object object)
Force the conversion of the object to a collection
|
Date |
toDate(Object object)
Convert the given object to a
Date object |
Map |
toMap(Object object)
Force the conversion of the target object to a map
|
Number |
toNumber(Object object)
Coerce the object to a numeric value
|
String |
toString(Object target)
Convert the given object to a string.
|
public static final Set<Class<?>> PRIMITIVE_CLASSES
Set
that stores all the supported primitive classes.public static final String TO_STRING_METHOD
public boolean isPrimitive(Object obj)
RuntimeObjectModel
isPrimitive
in interface RuntimeObjectModel
obj
- the target objecttrue
if the target
is a primitive, false
otherwisepublic boolean isDate(Object target)
RuntimeObjectModel
isDate
in interface RuntimeObjectModel
target
- the target objecttrue
if the target
is a date or calendar, false
otherwisepublic boolean isNumber(Object target)
RuntimeObjectModel
isNumber
in interface RuntimeObjectModel
target
- the target objecttrue
if the target
is a number, false
otherwisepublic boolean isCollection(Object target)
RuntimeObjectModel
Collection
or is backed by one.isCollection
in interface RuntimeObjectModel
target
- the target objecttrue
if the target
is a collection or is backed by one, false
otherwisepublic Object resolveProperty(Object target, Object property)
RuntimeObjectModel
resolveProperty
in interface RuntimeObjectModel
target
- the target objectproperty
- the property to be resolvedpublic boolean toBoolean(Object object)
RuntimeObjectModel
toBoolean
in interface RuntimeObjectModel
object
- the target objectpublic Number toNumber(Object object)
RuntimeObjectModel
toNumber
in interface RuntimeObjectModel
object
- the target objectpublic Date toDate(Object object)
RuntimeObjectModel
Date
objecttoDate
in interface RuntimeObjectModel
object
- the target objectobject
public String toString(Object target)
RuntimeObjectModel
toString
in interface RuntimeObjectModel
target
- the target objectpublic Collection<Object> toCollection(Object object)
RuntimeObjectModel
toCollection
in interface RuntimeObjectModel
object
- the target objectpublic Map toMap(Object object)
RuntimeObjectModel
toMap
in interface RuntimeObjectModel
object
- the target objectprotected Collection<Object> obtainCollection(Object obj)
protected String collectionToString(Collection<?> col)
protected Collection<Object> fromIterator(Iterator<Object> iterator)
protected boolean toBooleanInternal(Object obj)
protected static boolean isMethodAllowed(Method method)
Copyright © 2017 The Apache Software Foundation. All rights reserved.