Package org.osgi.util.converter
Interface Functioning
-
- All Superinterfaces:
Specifying<Functioning>
@ProviderType public interface Functioning extends Specifying<Functioning>
This interface is used to specify the target function to perform conversions. This function can be used multiple times. AFunctioning
instance can be obtained via theConverter
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Function<java.lang.Object,T>
to(java.lang.Class<T> cls)
Specify the target object type for the conversion as a class object.<T> Function<java.lang.Object,T>
to(java.lang.reflect.Type type)
Specify the target object type as a Java Reflection Type object.<T> Function<java.lang.Object,T>
to(TypeReference<T> ref)
Specify the target object type as aTypeReference
.-
Methods inherited from interface org.osgi.util.converter.Specifying
defaultValue, keysIgnoreCase, sourceAs, sourceAsBean, sourceAsDTO, targetAs, targetAsBean, targetAsDTO, view
-
-
-
-
Method Detail
-
to
<T> Function<java.lang.Object,T> to(java.lang.Class<T> cls)
Specify the target object type for the conversion as a class object.- Parameters:
cls
- The class to convert to.- Returns:
- A function that can perform the conversion.
-
to
<T> Function<java.lang.Object,T> to(java.lang.reflect.Type type)
Specify the target object type as a Java Reflection Type object.- Parameters:
type
- A Type object to represent the target type to be converted to.- Returns:
- A function that can perform the conversion.
-
to
<T> Function<java.lang.Object,T> to(TypeReference<T> ref)
Specify the target object type as aTypeReference
. If the target class carries generics information a TypeReference should be used as this preserves the generic information whereas a Class object has this information erased. Example use:List<String> result = converter.function() .to(new TypeReference<List<String>>() {});
- Parameters:
ref
- A type reference to the object being converted to.- Returns:
- A function that can perform the conversion.
-
-