public class ComplexValue extends StructureBase
Encapsulates an OData complex value.
Constructor and Description |
---|
ComplexValue()
|
ComplexValue(boolean withDefaults)
|
ComplexValue(boolean withDefaults,
ComplexType type)
Construct a new complex value.
|
Modifier and Type | Method and Description |
---|---|
static ComplexValue |
castOptional(DataValue value)
For internal use only.
|
static ComplexValue |
castRequired(DataValue value)
For internal use only.
|
ComplexValue |
copyComplex()
Return a copy of this complex value (only structural properties are copied).
|
static boolean |
equal(ComplexValue a,
ComplexValue b)
Return
true if two complex values have equal structural properties. |
ComplexType |
getComplexType()
Return the complex type metadata for this value (
ComplexValue.dataType cast to ComplexType ). |
DataType |
getDataType()
Return data type with a
DataType.code of DataType.COMPLEX_VALUE. |
ComplexValue |
getOldComplex()
Return (nullable) Contains the original values for all structural properties of this complex value.
|
int |
getTypeCode()
Return data type code of the wrapped value, equivalent to
dataType.code . |
boolean |
isNewOrChanged(Property property)
Return
true if the value of property property is new or changed, relative to ComplexValue.oldComplex . |
static ComplexValue |
ofType(ComplexType type)
Construct a new complex value of the specified type.
|
void |
setOldComplex(ComplexValue value)
Set contains the original values for all structural properties of this complex value.
|
java.lang.String |
toString()
Convert this data value to a string.
|
getDataValue, getDynamic, getDynamicProperties, getNextLink, getOptionalValue, getRequiredValue, getStreamLink, getStructureType, getValuePath, hasDataType, hasDataValue, hasDynamicProperties, hasNextLink, isNull, isProxy, setDataValue, setDefaultValues, setDefaultValues, setDefaultValues, setDefaultValues, setDefaultValues, setDefaultValues, setDynamic, setDynamicProperties, setNull, setOptionalValue, setRequiredValue, setValuePath, unsetDataValue
cloneMutable, equals, hashCode
public ComplexValue()
public ComplexValue(boolean withDefaults)
withDefaults
- WithDefaults parameter.public ComplexValue(boolean withDefaults, ComplexType type)
Construct a new complex value.
This constructor is intended for use by custom complex value subclasses.
Use ComplexValue.ofType
for regular construction.
type
- (nullable) Complex type. Should not be null
except when called by generated proxy base classes.withDefaults
- Should ComplexValue.setDefaultValues
be called to initialize properties with default values?public static ComplexValue castOptional(DataValue value)
For internal use only.
value
- (internal use only)public static ComplexValue castRequired(DataValue value)
For internal use only.
value
- (internal use only)public ComplexValue copyComplex()
Return a copy of this complex value (only structural properties are copied).
public static boolean equal(ComplexValue a, ComplexValue b)
Return true
if two complex values have equal structural properties.
a
- (nullable) First complex value.b
- (nullable) Second complex value.true
if two complex values have equal structural properties.public ComplexType getComplexType()
Return the complex type metadata for this value (ComplexValue.dataType
cast to ComplexType
).
ComplexValue.dataType
cast to ComplexType
).public DataType getDataType()
Return data type with a DataType.code
of DataType.COMPLEX_VALUE.
getDataType
in class DataValue
DataType.code
of DataType.COMPLEX_VALUE.public ComplexValue getOldComplex()
Return (nullable) Contains the original values for all structural properties of this complex value.
Used by DataService.updateEntity
to determine the changed properties for PATCH requests.
public int getTypeCode()
Return data type code of the wrapped value, equivalent to dataType.code
.
getTypeCode
in class DataValue
dataType.code
.public boolean isNewOrChanged(Property property)
Return true
if the value of property property
is new or changed, relative to ComplexValue.oldComplex
.
isNewOrChanged
in class StructureBase
property
- Structural property.true
if the value of property property
is new or changed, relative to ComplexValue.oldComplex
.public static ComplexValue ofType(ComplexType type)
Construct a new complex value of the specified type.
type
- Complex type for the new value.public void setOldComplex(ComplexValue value)
Set contains the original values for all structural properties of this complex value.
Used by DataService.updateEntity
to determine the changed properties for PATCH requests.
value
- Contains the original values for all structural properties of this complex value.public java.lang.String toString()
Convert this data value to a string.
If the ComplexValue.dataType
is defined by XML Schema Part 2: Datatypes, then the corresponding lexical format is used.
JSON format is used for structured values (arrays and objects).