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 Object
getProperty
(Object target, Object propertyObj) boolean
isCollection
(Object target) Checks if an object is aCollection
or is backed by one.boolean
Checks if the provided object represents a date or calendar.boolean
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.resolveProperty
(Object target, Object property) Resolve a property of a target object and return its value.boolean
Convert the given object to a boolean valuetoCollection
(Object object) Force the conversion of the object to a collectionConvert the given object to aDate
objectConvert the given object to anInstant
objectForce 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:RuntimeObjectModel
Checks if the provided object represents a primitive data type or not.- Specified by:
isPrimitive
in interfaceRuntimeObjectModel
- Parameters:
obj
- the target object- Returns:
true
if thetarget
is a primitive,false
otherwise
-
isDate
Description copied from interface:RuntimeObjectModel
Checks if the provided object represents a date or calendar.- Specified by:
isDate
in interfaceRuntimeObjectModel
- Parameters:
target
- the target object- Returns:
true
if thetarget
is a date or calendar,false
otherwise
-
isNumber
Description copied from interface:RuntimeObjectModel
Checks if the provided object represents a number or not.- Specified by:
isNumber
in interfaceRuntimeObjectModel
- Parameters:
target
- the target object- Returns:
true
if thetarget
is a number,false
otherwise
-
isCollection
Description copied from interface:RuntimeObjectModel
Checks if an object is aCollection
or is backed by one.- Specified by:
isCollection
in interfaceRuntimeObjectModel
- Parameters:
target
- the target object- Returns:
true
if thetarget
is a collection or is backed by one,false
otherwise
-
resolveProperty
Description copied from interface:RuntimeObjectModel
Resolve a property of a target object and return its value. The property can be either an index or a name- Specified by:
resolveProperty
in interfaceRuntimeObjectModel
- Parameters:
target
- the target objectproperty
- the property to be resolved- Returns:
- the value of the property
-
toBoolean
Description copied from interface:RuntimeObjectModel
Convert the given object to a boolean value- Specified by:
toBoolean
in interfaceRuntimeObjectModel
- Parameters:
object
- the target object- Returns:
- the boolean representation of that object
-
toNumber
Description copied from interface:RuntimeObjectModel
Coerce the object to a numeric value- Specified by:
toNumber
in interfaceRuntimeObjectModel
- Parameters:
object
- the target object- Returns:
- the numeric representation
-
toDate
Description copied from interface:RuntimeObjectModel
Convert the given object to aDate
object- Specified by:
toDate
in interfaceRuntimeObjectModel
- Parameters:
object
- the target object- Returns:
- the date represented by the
object
-
toInstant
Description copied from interface:RuntimeObjectModel
Convert the given object to anInstant
object- Specified by:
toInstant
in interfaceRuntimeObjectModel
- Parameters:
object
- the target object- Returns:
- the date represented by the
object
-
toString
Description copied from interface:RuntimeObjectModel
Convert the given object to a string.- Specified by:
toString
in interfaceRuntimeObjectModel
- Parameters:
target
- the target object- Returns:
- the string representation of the object
-
toCollection
Description copied from interface:RuntimeObjectModel
Force the conversion of the object to a collection- Specified by:
toCollection
in interfaceRuntimeObjectModel
- Parameters:
object
- the target object- Returns:
- the collection representation of the object
-
toMap
Description copied from interface:RuntimeObjectModel
Force the conversion of the target object to a map- Specified by:
toMap
in interfaceRuntimeObjectModel
- Parameters:
object
- the target object- Returns:
- a map representation of the object. Default is an empty map
-
getProperty
-