Package com.adobe.cq.gfx
Interface Instructions
-
- All Superinterfaces:
java.util.Map<java.lang.String,java.lang.Object>
- All Known Subinterfaces:
Layer
public interface Instructions extends java.util.Map<java.lang.String,java.lang.Object>
An extended map storing key-value instructions forrendering plans
.Provides type conversion and default value handling through generic getters and a convenience setter method allowing for chained operations.
Type Conversions
When values are added to the instructions, they will be stored as is. Any type conversion is done on reading only, usingget(String, Class)
orget(String, Object)
, depending on what format the consumer requires.When getting an object a consumer could ask for an object <T> or for a
Available type conversions between String and <T>:String
. The list below shows the availabe conversions between <T> and String, which will work in both ways (parsing string to retrieve object or serializing the object as string).Boolean
: true if string is "1"Integer
: normal decimal representation "123" usingInteger.toString(int)
Float
: normal floating point representation "3.14" usingFloat.toString(float)
Dimension
: represented as "width,height"Rectangle
: represented as "x,y,width,height"- other Objects are represented using
Object.toString()
when converted to string, but cannot be parsed from a string
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
get(java.lang.String name, java.lang.Class<T> type)
Get a named property andconvert it
into the given type if necessary.<T> T
get(java.lang.String name, T defaultValue)
Get a named property andconvert it
into the type given by the defaultValue argument, if necessary.<T> Instructions
set(java.lang.String name, T value)
Sets the value of a named property.
-
-
-
Method Detail
-
get
<T> T get(java.lang.String name, java.lang.Class<T> type)
Get a named property andconvert it
into the given type if necessary. If the property is not present or cannot be converted, returnnull
.- Parameters:
name
- The name of the propertytype
- The class of the type- Returns:
- Return named value converted to type T or
null
if non existing or cannot be converted. - See Also:
class javadoc for available type conversions
-
get
<T> T get(java.lang.String name, T defaultValue)
Get a named property andconvert it
into the type given by the defaultValue argument, if necessary. If the property is not present or cannot be converted, return the defaultValue.- Parameters:
name
- The name of the propertydefaultValue
- The default value to use if the named property does not exist or cannot be converted to the requested type. The default value is also used to define the type to convert the value to. If this isnull
any existing property is not converted.- Returns:
- Return named value converted to type T or the default value if non existing or cannot be converted.
- See Also:
class javadoc for available type conversions
-
set
<T> Instructions set(java.lang.String name, T value)
Sets the value of a named property.This allows chaining by returning the Instructions itself. Note that the object will be stored as is and no conversion will happen.
- Parameters:
name
- The name of the propertyvalue
- The value to set.- Returns:
- Returns
this
to allow for method chaining.
-
-