Package com.adobe.cq.gfx
Interface Instructions
- All Known Subinterfaces:
Layer
An extended map storing key-value instructions for
rendering 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) or get(String, Object),
depending on what format the consumer requires.
When getting an object a consumer could ask for an object <T> or for a 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
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescription<T> TGet a named property andconvert itinto the given type if necessary.<T> TGet a named property andconvert itinto the type given by the defaultValue argument, if necessary.<T> InstructionsSets the value of a named property.Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
get
Get a named property andconvert itinto 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
nullif non existing or cannot be converted. - See Also:
-
get
Get a named property andconvert itinto 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 isnullany 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:
-
set
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
thisto allow for method chaining.
-