This functionality is Sneak Peek status. This means that the APIs may change. We welcome your feedback, ideas, and code, but please use caution if you use this new functionality.
This page is still a rough draft.
Transforms a model based on a specified expansion rules objects.
(Object) the model to transform
(Object) a rules object containing instructions on how to transform the model (see below for more information)
(Object) a set of rules governing the transformations. At present this may contain the values:
isomorphic: true indicating that the output model is to be governed by the same schema found in the input model, or
flatSchema holding a flat schema object which consists of a hash of EL path specifications with wildcards, to the values "array"/"object" defining the schema to be used to construct missing trunk values.
Object the transformed model
Rules objects take the form of:
The Framework currently provides the following expanders that can be used as part of a model transformation.
Each of these is described below.
This extracts and/or the value of a given path, and can be used for the following purposes:
To rename a property:
Rule to rename "cat" to "feline":
To set a default value:
Rule to set default value of "gerbil":
Note that if "gerbil" has a value initially, it will be unaffected.
To specify a literal value:
Rule to set a value for "kangaroo":
To change the structure/nesting:
Rule to change the nesting:
arrayValue expander will transform a value into an aray. If the value is already an array, the expander will have no effect.
Rule to convert to arrays:
Note that the value of
cat is now an array, but the value of
sheep is unaffected.
In this example, description here...