Class ODataFunctionParameters
java.lang.Object
com.sap.cloud.sdk.datamodel.odata.client.request.AbstractODataParameters
com.sap.cloud.sdk.datamodel.odata.client.request.ODataFunctionParameters
Fluent API class to build and hold function parameters.
-
Constructor Summary
ConstructorDescriptionODataFunctionParameters
(ODataProtocol protocol) Create a new, empty set of parameters for an OData function. -
Method Summary
Modifier and TypeMethodDescription<PrimitiveT>
ODataFunctionParametersaddParameter
(String parameterName, PrimitiveT value) Add a parameter to function parameters.static ODataFunctionParameters
empty
(ODataProtocol protocol) Convenience method to create an empty set of function parameters.static ODataFunctionParameters
of
(Map<String, Object> parameters, ODataProtocol protocol) Create an instance ofODataFunctionParameters
from a set of parameters.Serializes all parameters into an encoded URL path segment.toEncodedString
(UriEncodingStrategy strategy) Serializes all parameters into an encoded URL path segment.toString()
Serializes all parameters into an unencoded URL path segment.Methods inherited from class com.sap.cloud.sdk.datamodel.odata.client.request.AbstractODataParameters
getProtocol
-
Constructor Details
-
ODataFunctionParameters
Create a new, empty set of parameters for an OData function.- Parameters:
protocol
- TheODataProtocol
version the parameters should conform to.
-
-
Method Details
-
of
@Nonnull public static ODataFunctionParameters of(@Nonnull Map<String, Object> parameters, @Nonnull ODataProtocol protocol) Create an instance ofODataFunctionParameters
from a set of parameters.- Parameters:
parameters
- Key-value pairs for parameter values.protocol
- TheODataProtocol
version these parameters should conform to.- Returns:
- A new instance of
ODataFunctionParameters
. - Throws:
IllegalArgumentException
- When the map contains a primitive type that is not supported.- See Also:
-
empty
Convenience method to create an empty set of function parameters.- Parameters:
protocol
- The OData protocol version that the parameters should conform to.- Returns:
- A new instance of
ODataFunctionParameters
-
addParameter
@Nonnull public <PrimitiveT> ODataFunctionParameters addParameter(@Nonnull String parameterName, @Nullable PrimitiveT value) Add a parameter to function parameters.- Type Parameters:
PrimitiveT
- Type of the primitive value.- Parameters:
parameterName
- Name of the property (derived from the EDMX)value
- Property value, assumed to be a primitive.- Returns:
- The modified instance.
- Throws:
IllegalArgumentException
- When a parameter by that idenfitier already exists or primitive type is not supported.
-
toEncodedString
Serializes all parameters into an encoded URL path segment. The format is as follows:- An empty set of parameters will yield
()
- One or more parameters will yield
(key1=val,key2=val)
- Overrides:
toEncodedString
in classAbstractODataParameters
- Returns:
- Encoded URL string representation of the parameters.
- An empty set of parameters will yield
-
toEncodedString
Serializes all parameters into an encoded URL path segment. The format is as follows:- An empty set of parameters will yield
()
- One or more parameters will yield
(key1=val,key2=val)
- Overrides:
toEncodedString
in classAbstractODataParameters
- Parameters:
strategy
- The URI encoding strategy.- Returns:
- Encoded URL string representation of the parameters.
- An empty set of parameters will yield
-
toString
Serializes all parameters into an unencoded URL path segment. The format is as follows:- An empty set of parameters will yield
()
- One or more parameters will yield
(key1=val,key2=val)
- Overrides:
toString
in classAbstractODataParameters
- Returns:
- String representation of the parameters.
- An empty set of parameters will yield
-