Top Description Fields Constructors Methods
org.osgi.util.converter

public Class TypeRule<F, T>

extends Object
implements TargetRule
Class Inheritance
All Implemented Interfaces
org.osgi.util.converter.TargetRule
Type Parameters
<F>
The type to convert from.
<T>
The type to convert to.
Imports
java.lang.reflect.Type, org.osgi.util.function.Function

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 the Rule implementation. Filtering on the to is done by the converter customization mechanism.
Author
$Id: dcc0515a681d76e46a561a14b7a13803a100aeaa $

Field Summary

Modifier and TypeField and Description
private final ConverterFunction
private final Type

Constructor Summary

AccessConstructor and Description
public
TypeRule(Type
The type to convert from.
from
,
Type
The type to convert to.
to
,
Function<F, T>
The conversion function to use.
func
)

Create an instance based on source, target types and a conversion function.

Method Summary

Modifier and TypeMethod and Description
private static <F, T> ConverterFunction
getFunction(final Type from, final Function<F, T> func)

public ConverterFunction
getFunction()

Implements org.osgi.util.converter.TargetRule.getFunction.

The function to perform the conversion.

public Type
getTargetType()

Implements org.osgi.util.converter.TargetRule.getTargetType.

The target type of this rule.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

functionback to summary
private final ConverterFunction function
toTypeback to summary
private final Type toType

Constructor Detail

TypeRuleback to summary
public TypeRule(Type from, Type to, Function<F, T> func)

Create an instance based on source, target types and a conversion function.

Parameters
from:Type

The type to convert from.

to:Type

The type to convert to.

func:Function<F, T>

The conversion function to use.

Method Detail

getFunctionback to summary
private static <F, T> ConverterFunction getFunction(final Type from, final Function<F, T> func)
getFunctionback to summary
public ConverterFunction getFunction()

Implements org.osgi.util.converter.TargetRule.getFunction.

Doc from org.osgi.util.converter.TargetRule.getFunction.

The function to perform the conversion.

Returns:ConverterFunction

The function.

Annotations
@Override
getTargetTypeback to summary
public Type getTargetType()

Implements org.osgi.util.converter.TargetRule.getTargetType.

Doc from org.osgi.util.converter.TargetRule.getTargetType.

The target type of this rule. The conversion function is invoked for each conversion to the target type.

Returns:Type

The target type.

Annotations
@Override