ObjectT
- The type of the implementing object.@Beta public abstract class VdmObject<ObjectT> extends Object
Modifier and Type | Field and Description |
---|---|
protected Map<String,Object> |
changedOriginalFields
A mapping of the OData field name to the original value.
|
static String |
ODATA_TYPE_ANNOTATION
The OData V4 JSON key to access an entity EDM type definition.
|
static String |
ODATA_VERSION_ANNOTATION
The OData V4 JSON key to access an entity version identifier.
|
Constructor and Description |
---|
VdmObject() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
protected void |
fromMap(Map<String,Object> values)
Read entity data from generic map.
|
Map<String,String> |
getAnnotationProperties() |
Map<String,Object> |
getChangedFields()
Returns map of all fields which have been changed on this entity along with their updated values.
|
<FieldT> FieldT |
getCustomField(SimpleProperty<ObjectT> customField)
This method allows for retrieval of custom fields that are added to the underlying OData services.
|
<FieldT> FieldT |
getCustomField(String customFieldName)
This method allows for retrieval of custom fields that are added to the underlying OData services.
|
Set<String> |
getCustomFieldNames() |
Map<String,Object> |
getCustomFields() |
protected ODataEntityKey |
getKey() |
abstract String |
getOdataType() |
protected Set<String> |
getSetOfCustomFields()
Get the custom field names.
|
protected Set<String> |
getSetOfFields()
Get the field names.
|
protected Set<String> |
getSetOfNavigationProperties()
Get navigation property names as set.
|
abstract Class<ObjectT> |
getType() |
boolean |
hasCustomField(SimpleProperty<ObjectT> customField)
Checks whether this object contains a value for the given custom field.
|
boolean |
hasCustomField(String customFieldName)
Checks whether this object contains a custom field with the given name.
|
int |
hashCode() |
protected void |
rememberChangedField(String fieldName,
Object valueBeforeChange)
Remembers the original value of a changed field.
|
void |
resetChangedFields()
Resets the map of all fields which have been changed on this entity.
|
<FieldT> void |
setCustomField(SimpleProperty<ObjectT> customField,
FieldT value)
Sets the value of a single custom field.
|
void |
setCustomField(String customFieldName,
Object value)
Sets the value of a single custom field.
|
protected Map<String,Object> |
toMap()
Translate the entity data to key-value map.
|
protected Map<String,Object> |
toMapOfCustomFields()
Get the custom fields as value map.
|
protected Map<String,Object> |
toMapOfFields()
Get all fields as map.
|
protected Map<String,Object> |
toMapOfNavigationProperties()
Get navigation properties as map.
|
String |
toString() |
public static final String ODATA_TYPE_ANNOTATION
public static final String ODATA_VERSION_ANNOTATION
@Nonnull protected final transient Map<String,Object> changedOriginalFields
This should be updated via rememberChangedField(String, Object)
on every set call of a property.
@Nonnull public Set<String> getCustomFieldNames()
@Nonnull public Map<String,Object> getCustomFields()
public void setCustomField(@Nonnull String customFieldName, @Nullable Object value)
customFieldName
- Name of the custom field.value
- Value of the custom field.public <FieldT> void setCustomField(@Nonnull SimpleProperty<ObjectT> customField, @Nullable FieldT value)
FieldT
- The type of the custom field to set.customField
- Name of the custom field, represented as an EntityField object.value
- Value of the custom field.public boolean hasCustomField(@Nonnull String customFieldName)
customFieldName
- Name of the custom field to check fortrue
if this entity has a custom field with the given name, false
otherwise.public boolean hasCustomField(@Nonnull SimpleProperty<ObjectT> customField)
customField
- Custom field to check for, represented as an EntityField
object.true
if this object has a custom field with the name of the given field, false
otherwise.@Nullable public <FieldT> FieldT getCustomField(@Nonnull String customFieldName) throws NoSuchElementException
FieldT
- The type of the returned field.customFieldName
- Name of the field returned by the underlying OData service.NoSuchElementException
- if no field with the given name could be found.@Nullable public <FieldT> FieldT getCustomField(@Nonnull SimpleProperty<ObjectT> customField) throws NoSuchElementException
FieldT
- The type of the returned field.customField
- Field returned by the underlying OData service.NoSuchElementException
- if no field with the given name could be found.@Nonnull public Map<String,String> getAnnotationProperties()
@Nonnull protected ODataEntityKey getKey()
protected void fromMap(Map<String,Object> values)
values
- The key-value map.@Nonnull protected Map<String,Object> toMapOfCustomFields()
@Nonnull protected Set<String> getSetOfCustomFields()
@Nonnull protected Map<String,Object> toMapOfFields()
@Nonnull protected Set<String> getSetOfFields()
@Nonnull protected Map<String,Object> toMapOfNavigationProperties()
@Nonnull protected Set<String> getSetOfNavigationProperties()
@Nonnull protected Map<String,Object> toMap()
@Nonnull public Map<String,Object> getChangedFields()
protected void rememberChangedField(@Nonnull String fieldName, @Nullable Object valueBeforeChange)
fieldName
- The name of the field that is changed.valueBeforeChange
- The original value before the change.public void resetChangedFields()
After calling this method, no field is considered changed, until you change the value of fields on this entity afterwards.
protected boolean canEqual(Object other)
Copyright © 2020 SAP SE. All rights reserved.