Class VdmEntity<EntityT>
- Type Parameters:
EntityT
- The specific entity data type.
- Direct Known Subclasses:
VdmMediaEntity
VdmObject
which is an entity. Entities may have a version identifier.-
Field Summary
Fields inherited from class com.sap.cloud.sdk.datamodel.odata.helper.VdmObject
changedOriginalFields
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
attachToService
(String servicePath, Destination destination) Sets the service path and destination for the fetch commands of this entity.protected boolean
boolean
fetchFieldAsList
(String fieldName, Class<T> fieldType) Helper method to lazily resolve a field value from current entity.protected <T extends VdmEntity<T>>
TfetchFieldAsSingle
(String fieldName, Class<T> fieldType) Helper method to lazily resolve a field value from current entity.protected String
Used by fluent helpers and navigation property methods to construct OData queries.protected Destination
Convienence field for reusing the same destination with multiple queries (e.g. fetching associated entities).protected abstract String
Used by fluent helpers and navigation property methods to construct OData queries.protected String
The service path only used for the fetch commands of this entity.io.vavr.control.Option<String>
Getter for the version identifier of this entity.int
hashCode()
protected void
setDestinationForFetch
(Destination destinationForFetch) Convienence field for reusing the same destination with multiple queries (e.g. fetching associated entities).protected void
setServicePathForFetch
(String servicePathForFetch) The service path only used for the fetch commands of this entity.void
setVersionIdentifier
(String versionIdentifier) Setter for the version identifier of this entity.Methods inherited from class com.sap.cloud.sdk.datamodel.odata.helper.VdmObject
fromMap, getChangedFields, getCustomField, getCustomField, getCustomFieldNames, getCustomFields, getKey, getSetOfCustomFields, getSetOfFields, getSetOfNavigationProperties, getType, hasCustomField, hasCustomField, rememberChangedField, resetChangedFields, setCustomField, setCustomField, toMap, toMapOfCustomFields, toMapOfFields, toMapOfNavigationProperties, toString
-
Constructor Details
-
VdmEntity
public VdmEntity()
-
-
Method Details
-
getVersionIdentifier
Getter for the version identifier of this entity.This identifier can be used to compare this entity with a remote one. As not the whole entity has to be sent this reduces the request overhead.
Actual use cases can be checking whether this entity is still current with regards to the remote entity, and ensuring that a update/delete operation is done on the expected version of the remote entity.
- Returns:
- The optional version identifier.
-
setVersionIdentifier
Setter for the version identifier of this entity.This identifier can be used to compare this entity with a remote one. As not the whole entity has to be sent this reduces the request overhead.
Actual use cases can be checking whether this entity is still current with regards to the remote entity, and ensuring that a update/delete operation is done on the expected version of the remote entity.
- Parameters:
versionIdentifier
- The version identifier of this entity.
-
getEntityCollection
Used by fluent helpers and navigation property methods to construct OData queries.- Returns:
- EDMX name of the entity collection identifier.
-
getDefaultServicePath
Used by fluent helpers and navigation property methods to construct OData queries.- Returns:
- Default context path to the OData service. In other words, everything in between the
protocol://hostname:port
and the OData resource name (entity set,$metadata
, etc.)
-
attachToService
Sets the service path and destination for the fetch commands of this entity. Also applies to any associated entities (navigation properties) that were previously fetched.Note: Use with caution, as this can easily break the fetch calls on this entity. See the interface of the corresponding service for the default service path.
- Parameters:
servicePath
- Optional parameter. New service path to apply to this entity and any associated entities that were previously fetched. If a null value is provided and the service path has never been set, then the service path will be set to the default defined in the corresponding service interface.destination
- New destination to apply to this entity and any associated entities that were previously fetched.
-
fetchFieldAsList
@Nonnull protected <T extends VdmEntity<T>> List<T> fetchFieldAsList(@Nonnull String fieldName, @Nonnull Class<T> fieldType) Helper method to lazily resolve a field value from current entity.- Type Parameters:
T
- The generic type parameter.- Parameters:
fieldName
- The field name to lookup.fieldType
- The field type to cast the value to.- Returns:
- A list of requested values.
-
fetchFieldAsSingle
@Nonnull protected <T extends VdmEntity<T>> T fetchFieldAsSingle(@Nonnull String fieldName, @Nonnull Class<T> fieldType) Helper method to lazily resolve a field value from current entity.- Type Parameters:
T
- The generic type parameter.- Parameters:
fieldName
- The field name to lookup.fieldType
- The field type to cast the value to.- Returns:
- The requested values.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getServicePathForFetch
The service path only used for the fetch commands of this entity.Note: Use with caution, as this can easily break the fetch call on this entity. See the interface of the corresponding service for the default service path.
-
setServicePathForFetch
The service path only used for the fetch commands of this entity.Note: Use with caution, as this can easily break the fetch call on this entity. See the interface of the corresponding service for the default service path.
-
getDestinationForFetch
Convienence field for reusing the same destination with multiple queries (e.g. fetching associated entities).- Returns:
- The stored destination for executing queries, or null if no such context has been set.
-
setDestinationForFetch
Convienence field for reusing the same destination with multiple queries (e.g. fetching associated entities).- Parameters:
destination
- New destination to apply to this entity
-