Interface DestinationProperties
- All Known Subinterfaces:
Destination
,HttpDestination
,HttpDestinationProperties
,RfcDestination
,RfcDestinationProperties
- All Known Implementing Classes:
DefaultDestination
,DefaultHttpDestination
,DefaultRfcDestination
public interface DestinationProperties
Interface representing the minimal information an arbitrary destination needs to implement.
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.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <ValueT> io.vavr.control.Option<ValueT>
get
(DestinationPropertyKey<ValueT> propertyKey) Convenience method to convert theObject
return type ofget(String)
into any expected type.io.vavr.control.Option<Object>
Gets the value associated with the given key (if any).default <ValueT> io.vavr.control.Option<ValueT>
Convenience method to cast theObject
return type ofget(String)
into the expected type.default <ValueT> io.vavr.control.Option<ValueT>
Convenience method to convert theObject
return type ofget(String)
into any expected type.Retrieves the set of property keys of the destination.
-
Method Details
-
get
Gets the value associated with the given key (if any).- Parameters:
key
- The key to get the value for.- Returns:
- An
Option
object containing the value, if any.
-
getPropertyNames
Retrieves the set of property keys of the destination.- Returns:
- An iterable of type String which is the set of property keys for a destination
-
get
@Nonnull default <ValueT> io.vavr.control.Option<ValueT> get(@Nonnull String key, @Nonnull Class<ValueT> expectedType) Convenience method to cast theObject
return type ofget(String)
into the expected type.- Type Parameters:
ValueT
- The expected type of the value.- Parameters:
key
- The key to get the value for.expectedType
- The expected type to cast the value to.- Returns:
- An
Option
object containing the converted value, if any. - Throws:
ClassCastException
- if the contained type cannot be cast to the expected type.
-
get
@Nonnull default <ValueT> io.vavr.control.Option<ValueT> get(@Nonnull String key, @Nonnull Function<Object, ValueT> conversion) Convenience method to convert theObject
return type ofget(String)
into any expected type.- Type Parameters:
ValueT
- The expected type of the value.- Parameters:
key
- The key to get the value for.conversion
- A function converting the object given byget(String)
into the expected type. Will never be called if no value (ornull
) is present for the given key.- Returns:
- An
Option
object containing the converted value, if any.
-
get
@Nonnull default <ValueT> io.vavr.control.Option<ValueT> get(@Nonnull DestinationPropertyKey<ValueT> propertyKey) Convenience method to convert theObject
return type ofget(String)
into any expected type.- Type Parameters:
ValueT
- The expected type of the value.- Parameters:
propertyKey
- TheDestinationPropertyKey
for the value to retrieve.- Returns:
- An
Option
object containing the converted value, if any.
-