Package com.smartgwt.client.docs
Interface SetterPath
public interface SetterPath
A path expression indicating where and how a nested Object should be updated.
A SetterPath is a dot-delimited list of segments, where each segment is a property name. The
SetterPath
can end in an operator that controls how the property update is done:
[]? append to an Array (creates the Array if missing){}? deep merge into an Object, overwriting existing keys{?}? deep merge into an Object, preserving existing keys (non-clobbering)
Task.setState()/Process.setStateVariable().
Missing objects and Arrays are created as needed unless strictPaths is set, either in
the specific API call, or on the task or process involved.
When strictPaths is enabled, attempting to traverse through a non-object/Array or a missing
segment throws an error instead.
Examples
Assumeprocess.state starts as:
{
currentDS: {
fields: [ { name:"orderId", type:"integer" } ],
defaults: { timezone:"UTC" }
}
}
- Append
"currentDS.fields[]": { name:"orderDate", type:"date" }
Result:fieldsgains a new element at the end. - Deep merge (clobber)
"currentDS.defaults{}": { timezone:"PST", dateFormat:"YYYY-MM-DD" }
Result:timezoneis overwritten to "PST";dateFormatis added. - Deep merge (non-clobber)
"currentDS.defaults{?}": { timezone:"PST", locale:"en-US" }
Result: existingtimezone:"UTC"is preserved;localeis added.