public interface ObjectValue extends Value
ArrayValue
.Modifier and Type | Method and Description |
---|---|
default void |
addField(java.lang.String name,
Value value)
Add a field with the given name and value to this ObjectValue instance.
|
void |
addFieldWithDisplayName(java.lang.String name,
Value value,
java.lang.String displayName)
Add a field with the given name and value to this ObjectValue instance.
|
default void |
removeField(java.lang.String name,
Value value)
Removes the field with the given name and
Value instance. |
void |
replaceField(java.lang.String name,
Value previous,
Value newField)
Replaces the field with the given name and
Value instance with the given new field. |
addParent, field, fieldFor, fields, id, parent, parentFor, parents, removeParent, replaceParent, setValueString, typeEquals, typeName, valueString
matches
canResolve, getResolvableNames, resolve
fromJson, toJson
default void addField(java.lang.String name, Value value)
Value
type.name
- The name of the new field to be added.value
- The value of the new field to be added.void addFieldWithDisplayName(java.lang.String name, Value value, java.lang.String displayName)
Value
type.
When displaying this field, the given displayName should be used.name
- The name of the new field to be added.value
- The value of the new field to be added.displayName
- The name of the new field to use for displaying the field.void replaceField(java.lang.String name, Value previous, Value newField)
Value
instance with the given new field. If the old field
doesn't exist, the behavior is undefined. It may either add the new field or not. Setting the newField to null
removes the field with the given name and value.name
- The name of the field to replace.previous
- The previous field which should be replaced.newField
- The new field which should replace the previous parent. Set it to null to remove the field with
the given name and value.default void removeField(java.lang.String name, Value value)
Value
instance. The default implementation calls
replaceField(String, Value, Value)
, setting the third argument to be null.name
- The name of the field to remove.value
- The value of the field to remove.