Interface DestinationProperties
- All Known Subinterfaces:
Destination,HttpDestination,HttpDestinationProperties,RfcDestination,RfcDestinationProperties
- All Known Implementing Classes:
DefaultDestination,DefaultHttpDestination,DefaultRfcDestination,TransparentProxyDestination
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 theObjectreturn 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 theObjectreturn type ofget(String)into the expected type.default <ValueT> io.vavr.control.Option<ValueT>Convenience method to convert theObjectreturn 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
Optionobject 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 theObjectreturn 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
Optionobject 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 theObjectreturn 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
Optionobject containing the converted value, if any.
-
get
@Nonnull default <ValueT> io.vavr.control.Option<ValueT> get(@Nonnull DestinationPropertyKey<ValueT> propertyKey) Convenience method to convert theObjectreturn type ofget(String)into any expected type.- Type Parameters:
ValueT- The expected type of the value.- Parameters:
propertyKey- TheDestinationPropertyKeyfor the value to retrieve.- Returns:
- An
Optionobject containing the converted value, if any.
-