Constructor and Description |
---|
ValueUtil() |
Modifier and Type | Method and Description |
---|---|
static IValueMap |
generateValue(IDataModel dataModel,
Map<String,Object> data,
boolean autoCoerce)
Construct the value object according to provided
DataModel structured based on result (Java Object) of operation execution. |
static IValueMap |
generateValue(IDataModel dataModel,
Map<String,Object> data,
boolean autoCoerce,
boolean generateNullForPropsNotInData)
Construct the value object according to provided
DataModel structured based on result (Java Object) of operation execution. |
static IValueMap |
generateValue(IDataModel dataModel,
Map<String,Object> data,
boolean autoCoerce,
boolean generateNullForPropsNotInData,
boolean removeComputedAttributes)
Construct the value object according to provided
DataModel structured based on result (Java Object) of operation execution. |
static IValue |
generateValue(IProperty property,
Object data,
boolean autoCoerce)
Construct the value object according to provided
Property and based on result (Java Object) of operation execution. |
static IValue |
generateValue(IProperty property,
Object data,
boolean autoCoerce,
boolean generateNullForPropsNotInData)
Construct the value object according to provided
Property and based on result (Java Object) of operation execution. |
static IValue |
generateValue(IProperty property,
Object data,
boolean autoCoerce,
boolean generateNullForPropsNotInData,
boolean removeComputedAttributes)
Construct the value object according to provided
Property and based on result (Java Object) of operation execution. |
static org.apache.commons.beanutils.ConvertUtilsBean |
getConversionUtil()
Utility method to provided the Conversion provider
|
static Object |
getFormattedValue(Object value)
Return formatted value for provided input.
|
static IValue |
getValue(IValueMap valueMap,
String name)
Get the value object associated with a key.
|
static IValueList |
jsonListToValue(org.apache.sling.commons.json.JSONArray array)
Construct the value object based on the provided
JSONArray . |
static IValueMap |
jsonObjectToValue(org.apache.sling.commons.json.JSONObject data)
Construct the value object based on the provided
JSONObject . |
static IValue |
jsonToValue(Object data)
Construct the value object based on the provided json object or array.
|
static IValue |
jsonToValue(String jsonString,
IProperty property)
Construct the value object based on the provided json string.
|
public static IValue generateValue(IProperty property, Object data, boolean autoCoerce) throws DermisException
Property
and based on result (Java Object) of operation execution.
if autoCoerce is false if any type/value is mismatched then DermisExceptionCodes.PROPERTY_TYPE_MISS_MATCH
exception is thrown and if its true it will try to convert the value according to property typeproperty
- - Property
according to which value object is constructed.data
- - Result of operation execution.autoCoerce
- - boolean value represent to auto coerce the value according to typeIValue
representing the output of operation.{@link
- DermisException}DermisException
public static IValue generateValue(IProperty property, Object data, boolean autoCoerce, boolean generateNullForPropsNotInData) throws DermisException
Property
and based on result (Java Object) of operation execution.
if autoCoerce is false if any type/value is mismatched then DermisExceptionCodes.PROPERTY_TYPE_MISS_MATCH
exception is thrown and if its true it will try to convert the value according to property typeproperty
- - Property
according to which value object is constructed.data
- - Result of operation execution.autoCoerce
- - boolean value represent to auto coerce the value according to typegenerateNullForPropsNotInData
- - boolean if this is true, properties for which no value is present in data, are included in the output with value null. If value of this parameter is false, null valued properties are omitted entirely from the outputIValue
representing the output of operation.{@link
- DermisException}DermisException
public static IValue generateValue(IProperty property, Object data, boolean autoCoerce, boolean generateNullForPropsNotInData, boolean removeComputedAttributes) throws DermisException
Property
and based on result (Java Object) of operation execution.
if autoCoerce is false if any type/value is mismatched then DermisExceptionCodes.PROPERTY_TYPE_MISS_MATCH
exception is thrown and if its true it will try to convert the value according to property typeproperty
- - Property
according to which value object is constructed.data
- - Result of operation execution.autoCoerce
- - boolean value represent to auto coerce the value according to typegenerateNullForPropsNotInData
- - boolean if this is true, properties for which no value is present in data, are included in the output with value null. If value of this parameter is false, null valued properties are omitted entirely from the outputremoveComputedAttributes
- - boolean if this is true, computed attributes will be removed from the outputIValue
representing the output of operation.{@link
- DermisException}DermisException
public static IValueMap generateValue(IDataModel dataModel, Map<String,Object> data, boolean autoCoerce) throws DermisException
DataModel
structured based on result (Java Object) of operation execution.dataModel
- - DataModel
according to which value object is constructed.data
- - Result of operation execution.autoCoerce
- - boolean value represent to auto coerce the value according to typeDermisException
public static IValueMap generateValue(IDataModel dataModel, Map<String,Object> data, boolean autoCoerce, boolean generateNullForPropsNotInData) throws DermisException
DataModel
structured based on result (Java Object) of operation execution.dataModel
- - DataModel
according to which value object is constructed.data
- - Result of operation execution.autoCoerce
- - boolean value represent to auto coerce the value according to typegenerateNullForPropsNotInData
- - boolean if this is true, child properties for which no value is present in data, are included in the output with value null. If value of this parameter is false, null valued properties are omitted entirely from the outputDermisException
public static IValueMap generateValue(IDataModel dataModel, Map<String,Object> data, boolean autoCoerce, boolean generateNullForPropsNotInData, boolean removeComputedAttributes) throws DermisException
DataModel
structured based on result (Java Object) of operation execution.dataModel
- - DataModel
according to which value object is constructed.data
- - Result of operation execution.autoCoerce
- - boolean value represent to auto coerce the value according to typegenerateNullForPropsNotInData
- - boolean if this is true, child properties for which no value is present in data, are included in the output with value null. If value of this parameter is false, null valued properties are omitted entirely from the outputremoveComputedAttributes
- - boolean if this is true, computed attributes will be removed from the outputDermisException
public static org.apache.commons.beanutils.ConvertUtilsBean getConversionUtil()
public static IValue jsonToValue(String jsonString, IProperty property) throws DermisException, org.apache.sling.commons.json.JSONException
jsonString
- - input json string.IValue
representing the output of operation.{@link
- JSONException}DermisException
org.apache.sling.commons.json.JSONException
public static IValue jsonToValue(Object data) throws DermisException, org.apache.sling.commons.json.JSONException
data
- - data representing JSONArray
or JSONObject
IValue
representing the output of operation.{@link
- JSONException}DermisException
org.apache.sling.commons.json.JSONException
public static IValueMap jsonObjectToValue(org.apache.sling.commons.json.JSONObject data) throws DermisException, org.apache.sling.commons.json.JSONException
JSONObject
.data
- - data representing JSONObject
IValue
representing the output of operation.{@link
- JSONException}DermisException
org.apache.sling.commons.json.JSONException
public static IValueList jsonListToValue(org.apache.sling.commons.json.JSONArray array) throws DermisException, org.apache.sling.commons.json.JSONException
JSONArray
.array
- - data representing JSONArray
IValue
representing the output of operation.{@link
- JSONException}DermisException
org.apache.sling.commons.json.JSONException
public static Object getFormattedValue(Object value)
value
- - input value to format.Copyright © 1982–2022 Adobe Systems Inc.. All rights reserved.