TInput
- The type of object that is to be converted.TOutput
- The type the input object is to be converted to.public abstract class Converter<TInput,TOutput> extends Delegate implements Function<TInput,TOutput>
Modifier and Type | Class and Description |
---|---|
static interface |
Converter.Function<TInput,TOutput>
A functional interface for the containing delegate type.
|
Constructor and Description |
---|
Converter()
Creates a new instance of this delegate.
|
Converter(Class<?> targetClass,
String methodName,
Class<?>... methodParameterClasses)
Initializes a delegate that will invoke a static method on a class.
|
Converter(Object targetObject,
String methodName,
Class<?>... methodParameterClasses)
Initializes a delegate that will invoke an instance method on a class instance.
|
Modifier and Type | Method and Description |
---|---|
TOutput |
apply(TInput t)
Applies this function to the given argument.
|
abstract TOutput |
invoke(TInput input)
Represents a method that converts an object from one type to another type.
|
static <TInput,TOutput> |
of(Converter.Function<TInput,TOutput> f)
Create a delegate for the given interface.
|
static <TInput,TOutput> |
of(Converter.Function<TInput,TOutput> f,
Class<?> targetClass,
String methodName,
Class<?>... methodParameterClasses)
Create a delegate for the given interface.
|
static <TInput,TOutput> |
of(Converter.Function<TInput,TOutput> f,
Object targetObject,
String methodName,
Class<?>... methodParameterClasses)
Create a delegate for the given interface.
|
dynamicInvoke, equals, getMethod, getTarget, hashCode
public Converter()
public Converter(@Nonnull Object targetObject, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
targetObject
- The class instance on which the delegate will invoke the method.methodName
- The name of the instance method.methodParameterClasses
- The type of the parameters of the instance method.public Converter(@Nonnull Class<?> targetClass, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
targetClass
- The class that defines the method.methodName
- The name of the static method.methodParameterClasses
- The type of the parameters of the static method.public abstract TOutput invoke(TInput input)
input
- The object to convert.public final TOutput apply(TInput t)
java.util.function.Function
@Nonnull public static <TInput,TOutput> Converter<TInput,TOutput> of(@Nonnull Converter.Function<TInput,TOutput> f)
f
- The function which will be invoked.@Nonnull public static <TInput,TOutput> Converter<TInput,TOutput> of(@Nonnull Converter.Function<TInput,TOutput> f, @Nonnull Object targetObject, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
f
- The function which will be invoked.targetObject
- The class instance on which the delegate will invoke the method.methodName
- The name of the instance method.methodParameterClasses
- The type of the parameters of the instance method.@Nonnull public static <TInput,TOutput> Converter<TInput,TOutput> of(@Nonnull Converter.Function<TInput,TOutput> f, @Nonnull Class<?> targetClass, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
f
- The function which will be invoked.targetClass
- The class that defines the method.methodName
- The name of the static method.methodParameterClasses
- The type of the parameters of the static method.