Class AbstractRuntimeObjectModel
java.lang.Object
org.apache.sling.scripting.sightly.render.AbstractRuntimeObjectModel
- All Implemented Interfaces:
RuntimeObjectModel
- Direct Known Subclasses:
SlingRuntimeObjectModel
Default abstract implementation of
RuntimeObjectModel.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectgetProperty(Object target, Object propertyObj) booleanisCollection(Object target) Checks if an object is aCollectionor is backed by one.booleanChecks if the provided object represents a date or calendar.booleanChecks if the provided object represents a number or not.booleanisPrimitive(Object obj) Checks if the provided object represents a primitive data type or not.resolveProperty(Object target, Object property) Resolve a property of a target object and return its value.booleanConvert the given object to a boolean valuetoCollection(Object object) Force the conversion of the object to a collectionConvert the given object to aDateobjectConvert the given object to anInstantobjectForce the conversion of the target object to a mapCoerce the object to a numeric valueConvert the given object to a string.
-
Constructor Details
-
AbstractRuntimeObjectModel
public AbstractRuntimeObjectModel()
-
-
Method Details
-
isPrimitive
Description copied from interface:RuntimeObjectModelChecks if the provided object represents a primitive data type or not.- Specified by:
isPrimitivein interfaceRuntimeObjectModel- Parameters:
obj- the target object- Returns:
trueif thetargetis a primitive,falseotherwise
-
isDate
Description copied from interface:RuntimeObjectModelChecks if the provided object represents a date or calendar.- Specified by:
isDatein interfaceRuntimeObjectModel- Parameters:
target- the target object- Returns:
trueif thetargetis a date or calendar,falseotherwise
-
isNumber
Description copied from interface:RuntimeObjectModelChecks if the provided object represents a number or not.- Specified by:
isNumberin interfaceRuntimeObjectModel- Parameters:
target- the target object- Returns:
trueif thetargetis a number,falseotherwise
-
isCollection
Description copied from interface:RuntimeObjectModelChecks if an object is aCollectionor is backed by one.- Specified by:
isCollectionin interfaceRuntimeObjectModel- Parameters:
target- the target object- Returns:
trueif thetargetis a collection or is backed by one,falseotherwise
-
resolveProperty
Description copied from interface:RuntimeObjectModelResolve a property of a target object and return its value. The property can be either an index or a name- Specified by:
resolvePropertyin interfaceRuntimeObjectModel- Parameters:
target- the target objectproperty- the property to be resolved- Returns:
- the value of the property
-
toBoolean
Description copied from interface:RuntimeObjectModelConvert the given object to a boolean value- Specified by:
toBooleanin interfaceRuntimeObjectModel- Parameters:
object- the target object- Returns:
- the boolean representation of that object
-
toNumber
Description copied from interface:RuntimeObjectModelCoerce the object to a numeric value- Specified by:
toNumberin interfaceRuntimeObjectModel- Parameters:
object- the target object- Returns:
- the numeric representation
-
toDate
Description copied from interface:RuntimeObjectModelConvert the given object to aDateobject- Specified by:
toDatein interfaceRuntimeObjectModel- Parameters:
object- the target object- Returns:
- the date represented by the
object
-
toInstant
Description copied from interface:RuntimeObjectModelConvert the given object to anInstantobject- Specified by:
toInstantin interfaceRuntimeObjectModel- Parameters:
object- the target object- Returns:
- the date represented by the
object
-
toString
Description copied from interface:RuntimeObjectModelConvert the given object to a string.- Specified by:
toStringin interfaceRuntimeObjectModel- Parameters:
target- the target object- Returns:
- the string representation of the object
-
toCollection
Description copied from interface:RuntimeObjectModelForce the conversion of the object to a collection- Specified by:
toCollectionin interfaceRuntimeObjectModel- Parameters:
object- the target object- Returns:
- the collection representation of the object
-
toMap
Description copied from interface:RuntimeObjectModelForce the conversion of the target object to a map- Specified by:
toMapin interfaceRuntimeObjectModel- Parameters:
object- the target object- Returns:
- a map representation of the object. Default is an empty map
-
getProperty
-