@Beta public class ODataEntityKey extends AbstractODataParameters
Constructor and Description |
---|
ODataEntityKey(ODataProtocol protocol)
Create a new, empty entity key for the given protocol version.
|
Modifier and Type | Method and Description |
---|---|
ODataEntityKey |
addKeyProperties(Map<String,Object> properties)
Add properties to the OData entity key.
|
<PrimitiveT> |
addKeyProperty(String propertyName,
PrimitiveT value)
Add an entity property to this key.
|
Set<String> |
getFieldNames()
Get all field names that are part of this key.
|
static ODataEntityKey |
of(Map<String,Object> key,
ODataProtocol protocol)
Create an instance of
ODataEntityKey from a generic key-value composition. |
String |
toEncodedString()
Serializes the entity key into an encoded OData URL format for entity keys.
|
String |
toString()
Serializes the entity key into an unencoded OData URL format for entity keys.
|
getProtocol
public ODataEntityKey(@Nonnull ODataProtocol protocol)
protocol
- The ODataProtocol
version this key should conform to.@Nonnull public Set<String> getFieldNames()
@Nonnull public <PrimitiveT> ODataEntityKey addKeyProperty(@Nonnull String propertyName, @Nullable PrimitiveT value)
PrimitiveT
- Type of the primitive value.propertyName
- Name of the property (derived from the EDMX)value
- Property value, assumed to be a primitive.IllegalArgumentException
- When a parameter by that idenfitier already exists or primitive type is not supported.@Nonnull public ODataEntityKey addKeyProperties(@Nonnull Map<String,Object> properties)
properties
- The key-value mapping.IllegalArgumentException
- When the map contains a primitive type that is not supported.addKeyProperty(String, Object)
@Nonnull public static ODataEntityKey of(@Nonnull Map<String,Object> key, @Nonnull ODataProtocol protocol)
ODataEntityKey
from a generic key-value composition.key
- Key-value pairs of entity properties and their values.protocol
- The ODataProtocol
version this key should conform to.ODataEntityKey
.IllegalArgumentException
- When the map contains a primitive type that is not supported.addKeyProperty(String, Object)
@Nonnull public String toEncodedString()
toEncodedString
in class AbstractODataParameters
@Nonnull public String toString()
toString
in class AbstractODataParameters
Copyright © 2021 SAP SE. All rights reserved.