Package org.osgi.util.converter
Class TypeRule<F,T>
- java.lang.Object
-
- org.osgi.util.converter.TypeRule<F,T>
-
- Type Parameters:
F
- The type to convert from.T
- The type to convert to.
- All Implemented Interfaces:
TargetRule
public class TypeRule<F,T> extends java.lang.Object implements TargetRule
Rule implementation that works by passing in type arguments rather than subclassing. The rule supports specifying both from and to types. Filtering on the from by theRule
implementation. Filtering on the to is done by the converter customization mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description private ConverterFunction
function
private java.lang.reflect.Type
toType
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ConverterFunction
getFunction()
The function to perform the conversion.private static <F,T>
ConverterFunctiongetFunction(java.lang.reflect.Type from, Function<F,T> func)
java.lang.reflect.Type
getTargetType()
The target type of this rule.
-
-
-
Field Detail
-
function
private final ConverterFunction function
-
toType
private final java.lang.reflect.Type toType
-
-
Method Detail
-
getFunction
private static <F,T> ConverterFunction getFunction(java.lang.reflect.Type from, Function<F,T> func)
-
getFunction
public ConverterFunction getFunction()
Description copied from interface:TargetRule
The function to perform the conversion.- Specified by:
getFunction
in interfaceTargetRule
- Returns:
- The function.
-
getTargetType
public java.lang.reflect.Type getTargetType()
Description copied from interface:TargetRule
The target type of this rule. The conversion function is invoked for each conversion to the target type.- Specified by:
getTargetType
in interfaceTargetRule
- Returns:
- The target type.
-
-