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 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 the `Rule` implementation. Filtering on the to is done by the converter customization mechanism.

Author:
  $Id$

### Constructor Summary

Constructors
Constructor and Description
`TypeRule(Type from, Type to, org.osgi.util.function.Function<F,T> func)` Create an instance based on source, target types and a conversion function.

### Method Summary

All Methods Instance Methods Concrete Methods
`ConverterFunction` `getFunction()` The function to perform the conversion.
`Type` `getTargetType()` The target type of this rule.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### TypeRule

    public TypeRule(Type from,
                    Type to,
                    org.osgi.util.function.Function<F,T> func)

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

Parameters:
  `from` - The type to convert from.
  `to` - The type to convert to.
  `func` - The conversion function to use.

### Method Detail

#### getFunction

    public ConverterFunction getFunction()

Description copied from interface: `TargetRule`
The function to perform the conversion.

Specified by:
  `getFunction` in interface `TargetRule`
Returns:
  The function.

#### getTargetType

    public 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 interface `TargetRule`
Returns:
  The target type.