public interface DestinationProperties
As the interface suggests, a generic destination is just a store of key-value-pairs. The provided default methods allow type-safe to the values if the format of content is known.
Modifier and Type | Method and Description |
---|---|
default <ValueT> io.vavr.control.Option<ValueT> |
get(com.sap.cloud.sdk.cloudplatform.connectivity.DestinationPropertyKey<ValueT> propertyKey)
Convenience method to convert the
Object return type of get(String) into any expected type. |
io.vavr.control.Option<Object> |
get(String key)
Gets the value associated with the given key (if any).
|
default <ValueT> io.vavr.control.Option<ValueT> |
get(String key,
Class<ValueT> expectedType)
Convenience method to cast the
Object return type of get(String) into the expected type. |
default <ValueT> io.vavr.control.Option<ValueT> |
get(String key,
Function<Object,ValueT> conversion)
Convenience method to convert the
Object return type of get(String) into any expected type. |
Iterable<String> |
getPropertyNames()
Retrieves the set of property keys of the destination.
|
@Nonnull io.vavr.control.Option<Object> get(@Nonnull String key)
key
- The key to get the value for.Option
object containing the value, if any.@Nonnull Iterable<String> getPropertyNames()
@Nonnull default <ValueT> io.vavr.control.Option<ValueT> get(@Nonnull String key, @Nonnull Class<ValueT> expectedType)
Object
return type of get(String)
into the expected type.ValueT
- The expected type of the value.key
- The key to get the value for.expectedType
- The expected type to cast the value to.Option
object containing the converted value, if any.ClassCastException
- if the contained type cannot be cast to the expected type.@Nonnull default <ValueT> io.vavr.control.Option<ValueT> get(@Nonnull String key, @Nonnull Function<Object,ValueT> conversion)
Object
return type of get(String)
into any expected type.ValueT
- The expected type of the value.key
- The key to get the value for.conversion
- A function converting the object given by get(String)
into the expected type. Will never be
called if no value (or null
) is present for the given key.Option
object containing the converted value, if any.@Nonnull default <ValueT> io.vavr.control.Option<ValueT> get(@Nonnull com.sap.cloud.sdk.cloudplatform.connectivity.DestinationPropertyKey<ValueT> propertyKey)
Object
return type of get(String)
into any expected type.ValueT
- The expected type of the value.propertyKey
- The DestinationPropertyKey
for the value to retrieve.Option
object containing the converted value, if any.Copyright © 2020 SAP SE. All rights reserved.