Interface RuntimeObjectModel
- All Known Implementing Classes:
AbstractRuntimeObjectModel
,SlingRuntimeObjectModel
@ProviderType
public interface RuntimeObjectModel
The
RuntimeObjectModel
provides various utility object inspection & conversion methods that can be applied to runtime
objects when executing HTL scripts.-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.
-
Method Details
-
isPrimitive
Checks if the provided object represents a primitive data type or not.- Parameters:
obj
- the target object- Returns:
true
if thetarget
is a primitive,false
otherwise
-
isCollection
Checks if an object is aCollection
or is backed by one.- Parameters:
target
- the target object- Returns:
true
if thetarget
is a collection or is backed by one,false
otherwise
-
isNumber
Checks if the provided object represents a number or not.- Parameters:
target
- the target object- Returns:
true
if thetarget
is a number,false
otherwise
-
isDate
Checks if the provided object represents a date or calendar.- Parameters:
target
- the target object- Returns:
true
if thetarget
is a date or calendar,false
otherwise
-
resolveProperty
Resolve a property of a target object and return its value. The property can be either an index or a name- Parameters:
target
- the target objectproperty
- the property to be resolved- Returns:
- the value of the property
-
toBoolean
Convert the given object to a boolean value- Parameters:
object
- the target object- Returns:
- the boolean representation of that object
-
toNumber
Coerce the object to a numeric value- Parameters:
object
- the target object- Returns:
- the numeric representation
-
toDate
Convert the given object to aDate
object- Parameters:
object
- the target object- Returns:
- the date represented by the
object
-
toInstant
Convert the given object to anInstant
object- Parameters:
object
- the target object- Returns:
- the date represented by the
object
-
toString
Convert the given object to a string.- Parameters:
target
- the target object- Returns:
- the string representation of the object
-
toCollection
Force the conversion of the object to a collection- Parameters:
object
- the target object- Returns:
- the collection representation of the object
-
toMap
Force the conversion of the target object to a map- Parameters:
object
- the target object- Returns:
- a map representation of the object. Default is an empty map
-