public final class ScriptableUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
getOptionValue(ScriptableContext context,
Scriptable<T> callback)
Returns the value of the property as result of callback (the same type).
|
static <T> T |
getOptionValue(ScriptableContext context,
Scriptable<T> callback,
T defaultValue)
Returns the value of the property as result of callback (the same type), passing a default value.
|
static Object |
getOptionValueAsColor(ScriptableContext context,
Scriptable<?> callback,
String defaultValue)
Returns a color value of property by a callback, checking all different types of object which can be used as value of the
property in color ones.
By defaults, is able to manage also Pattern or CanvasPattern. |
static Object |
getOptionValueAsColor(ScriptableContext context,
Scriptable<?> callback,
String defaultValue,
boolean hasPattern)
Returns a color value of property by a callback, checking all different types of object which can be used as value of the
property in color ones.
|
static <T extends Key> |
getOptionValueAsString(ScriptableContext context,
Scriptable<T> callback)
Returns the enumeration value as value of the property by invoking a callback which is typed to a key.
|
static <T extends Key> |
getOptionValueAsString(ScriptableContext context,
Scriptable<T> callback,
T defaultValue)
Returns the enumeration value of the property by invoking a callback which is typed to a key, passing a default value.
|
static Object |
handleCallbackResultAsColor(ScriptableContext context,
Object result,
String defaultValue,
boolean hasPattern)
Returns a color value of property by a callback, checking all different types of object which can be used as value of the
property in color ones.
|
static IsChart |
retrieveChart(ScriptableContext context,
Object callback)
Returns the chart instance if callback and chart itself are consistent.
|
public static IsChart retrieveChart(ScriptableContext context, Object callback)
context - scriptable contextcallback - callback to check if consistentpublic static <T extends Key> T getOptionValueAsString(ScriptableContext context, Scriptable<T> callback)
T - type of callback which extends a keycontext - scriptable contextcallback - callback to invokepublic static <T extends Key> T getOptionValueAsString(ScriptableContext context, Scriptable<T> callback, T defaultValue)
T - type of callback which extends a keycontext - scriptable contextcallback - callback to invokedefaultValue - default value to return in case of chart, callback or result of callback are not consistent.public static <T> T getOptionValue(ScriptableContext context, Scriptable<T> callback)
T - type of callback resultcontext - scriptable contextcallback - callback to invokepublic static <T> T getOptionValue(ScriptableContext context, Scriptable<T> callback, T defaultValue)
T - type of callback resultcontext - scriptable contextcallback - callback to invokedefaultValue - default value to return in case of chart, callback or result of callback are not consistent.public static Object getOptionValueAsColor(ScriptableContext context, Scriptable<?> callback, String defaultValue)
Pattern or CanvasPattern.context - scriptable contextcallback - callback to invokedefaultValue - default value to return in case of chart, callback or result of callback are not consistent.public static Object getOptionValueAsColor(ScriptableContext context, Scriptable<?> callback, String defaultValue, boolean hasPattern)
context - scriptable contextcallback - callback to invokedefaultValue - default value to return in case of chart, callback or result of callback are not consistent.hasPattern - if true is able to manage also Pattern or CanvasPattern, otherwise it
skips them.public static Object handleCallbackResultAsColor(ScriptableContext context, Object result, String defaultValue, boolean hasPattern)
context - scriptable contextresult - result of callback invocationdefaultValue - default value to return in case of chart, callback or result of callback are not consistent.hasPattern - if true is able to manage also Pattern or CanvasPattern, otherwise it
skips them.