ObjectT
- The type of the implementing object.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.
|
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) |
Map<String,Object> |
getChangedFields()
Returns map of all fields which have been changed on this entity along with their updated values.
|
<FieldT> FieldT |
getCustomField(EntityField<ObjectT,FieldT> 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 Map<String,Object> |
getKey() |
protected Set<String> |
getSetOfCustomFields() |
protected Set<String> |
getSetOfFields() |
protected Set<String> |
getSetOfNavigationProperties() |
abstract Class<ObjectT> |
getType() |
boolean |
hasCustomField(EntityField<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(EntityField<ObjectT,FieldT> 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() |
protected Map<String,Object> |
toMapOfCustomFields() |
protected Map<String,Object> |
toMapOfFields() |
protected Map<String,Object> |
toMapOfNavigationProperties() |
String |
toString() |
@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 EntityField<ObjectT,FieldT> 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 EntityField<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 NoSuchEntityFieldException
FieldT
- The type of the returned field.customFieldName
- Name of the field returned by the underlying OData service.NoSuchEntityFieldException
- if no field with the given name could be found.@Nullable public <FieldT> FieldT getCustomField(@Nonnull EntityField<ObjectT,FieldT> customField) throws NoSuchEntityFieldException
FieldT
- The type of the returned field.customField
- Field returned by the underlying OData service.NoSuchEntityFieldException
- if no field with the given name could be found.@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.