|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.szegedi.expose.model.ReflectionUtilities
Utility class that provides generic services to reflection classes.
It handles all polymorphism issues in the wrap(Object) and unwrap(Object) methods.
| Field Summary | |
static boolean |
WRAP_AS_OBJECT
Use in the wrap() method to override logic for determining whether the parameter should be wrapped as a TemplateScalarModel or as a TemplateHashModel, and force wrapping into hash model. |
static boolean |
WRAP_AS_SCALAR
Use in the wrap() method to override logic for determining whether the parameter should be wrapped as a TemplateScalarModel or as a TemplateHashModel, and force wrapping into scalar. |
| Method Summary | |
static boolean |
isScalar(java.lang.Class clazz)
Determines whether the object of this class should be wrapped into a SimpleScalar (true), or into a descendant of ReflectionObjectModelBase (false).
|
static boolean |
isScalar(java.lang.Object object)
Determines whether the object should be wrapped into a SimpleScalar
(true), or into a descendant of ReflectionObjectModelBase (false).
|
static java.lang.Object |
unwrap(java.lang.Object model)
Attempts to unwrap a model into underlying object. |
static freemarker.template.TemplateModel |
wrap(java.lang.Object object)
Wraps the object with a template model that is most specific for the object's class. |
static freemarker.template.TemplateModel |
wrap(java.lang.Object object,
boolean asScalar)
Wraps the object with a template model that is most specific for the object's class, just as wrap(Object) would, however it can force wrapping into
scalar. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final boolean WRAP_AS_SCALAR
public static final boolean WRAP_AS_OBJECT
| Method Detail |
public static final boolean isScalar(java.lang.Class clazz)
SimpleScalar (true), or into a descendant of ReflectionObjectModelBase (false).
All classes representing primitive types, as well as String and Boolean qualify.public static final boolean isScalar(java.lang.Object object)
SimpleScalar
(true), or into a descendant of ReflectionObjectModelBase (false).
Convenience method for isScalar(Class) that deals with object being
null.
All classes representing primitive types, as well as String and Boolean qualify.public static final freemarker.template.TemplateModel wrap(java.lang.Object object)
Models.EMPTY_SCALAR,SimpleScalar for it,BooleanScalar for it,ReflectionArrayModel for it
ReflectionMapModel for it
ReflectionCollectionModel for it
ReflectionIteratorModel for it
ReflectionEnumerationModel for it
ReflectionObjectModel for it
public static final freemarker.template.TemplateModel wrap(java.lang.Object object,
boolean asScalar)
wrap(Object) would, however it can force wrapping into
scalar. (I.e. ReflectionMethodModel uses this when it knows that its return type
is a primitive type wrapper).object - the object to wrapasScalar. - If WRAP_AS_SCALAR, the object will be wrapped into
a scalar (in case it is neither a Boolean nor a String, its toString()
value is wrapped). If WRAP_AS_OBJECT, the object will be wrapped into
ReflectionObjectModel even if it is a String or Boolean.
public static final java.lang.Object unwrap(java.lang.Object model)
throws freemarker.template.TemplateModelException
ReflectionObjectModelBase and ReflectionScalarModel instances,
as well a generic TemplateScalarModel into a String. All other
objects are returned unchanged.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||