Top Description Fields Constructors Methods
org.apache.commons.collections4.functors

public Class FactoryTransformer<I, O>

extends Object
implements Transformer<I, O>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.collections4.Transformer
Imports
java.io.Serializable, org.apache.commons.collections4.Factory, .Transformer

Transformer implementation that calls a Factory and returns the result.
Since
3.0

Field Summary

Modifier and TypeField and Description
private final Factory<? extends O>
iFactory

The factory to wrap

private static final long
serialVersionUID

Serial version UID

Constructor Summary

AccessConstructor and Description
public
FactoryTransformer(final Factory<? extends O>
the factory to call, not null
factory
)

Constructor that performs no validation.

Method Summary

Modifier and TypeMethod and Description
public static <
the input type
I
,
the output type
O
>
Transformer<I, O>

Returns:

the factory transformer
factoryTransformer
(final Factory<? extends O>
the factory to call, not null
factory
)

Factory method that performs validation.

public Factory<? extends O>

Returns:

the factory
getFactory
()

Gets the factory.

public O

Returns:

the transformed result
transform
(final I
the input object to transform
input
)

Implements org.apache.commons.collections4.Transformer.transform.

Transforms the input by ignoring the input and returning the result of calling the decorated factory.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iFactoryback to summary
private final Factory<? extends O> iFactory

The factory to wrap

serialVersionUIDback to summary
private static final long serialVersionUID

Serial version UID

Constructor Detail

FactoryTransformerback to summary
public FactoryTransformer(final Factory<? extends O> factory)

Constructor that performs no validation. Use factoryTransformer if you want that.

Parameters
factory:Factory<? extends O>

the factory to call, not null

Method Detail

factoryTransformerback to summary
public static <I, O> Transformer<I, O> factoryTransformer(final Factory<? extends O> factory)

Factory method that performs validation.

Parameters
<I>
the input type
<O>
the output type
factory:Factory<? extends O>

the factory to call, not null

Returns:Transformer<I, O>

the factory transformer

Exceptions
NullPointerException:
if the factory is null
getFactoryback to summary
public Factory<? extends O> getFactory()

Gets the factory.

Returns:Factory<? extends O>

the factory

Since
3.1
transformback to summary
public O transform(final I input)

Implements org.apache.commons.collections4.Transformer.transform.

Transforms the input by ignoring the input and returning the result of calling the decorated factory.

Parameters
input:I

the input object to transform

Returns:O

the transformed result

Annotations
@Override