| Modifier and Type | Field and Description |
|---|---|
| private final Transformer | iDefault
The default transformer to call if no tests match |
| private final Predicate | iPredicates
The tests to consider |
| private final Transformer | iTransformers
The matching transformers to call |
| private static final long | serialVersionUID
Serial version UID |
| Access | Constructor and Description |
|---|---|
| private | SwitchTransformer(final boolean
if clone, final Predicate<? super I>[] true the input arguments will be clonedarray of predicates, no nulls predicates, final Transformer<? super I, ? extends O>[] matching array of transformers, no nulls transformers, final Transformer<? super I, ? extends O> the transformer to use if no match, null means return null defaultTransformer)Hidden constructor for the use by the static factory methods. |
| public | SwitchTransformer(final Predicate<? super I>[]
array of predicates, cloned, no nulls predicates, final Transformer<? super I, ? extends O>[] matching array of transformers, cloned, no nulls transformers, final Transformer<? super I, ? extends O> the transformer to use if no match, null means return null defaultTransformer)Constructor that performs no validation. |
| Modifier and Type | Method and Description |
|---|---|
| public Transformer | |
| public Predicate | |
| public Transformer | |
| public static < the input type I, the output type O> Transformer | Returns: thechained transformerarray of predicates, cloned, no nulls predicates, final Transformer<? super I, ? extends O>[] matching array of transformers, cloned, no nulls transformers, final Transformer<? super I, ? extends O> the transformer to use if no match, null means return null defaultTransformer)Factory method that performs validation and copies the parameter arrays. |
| public static < the input type I, the output type O> Transformer | Returns: theswitch transformera map of predicates to transformers map)Create a new Transformer that calls one of the transformers depending on the predicates. |
| public O | Returns: the transformed resultthe input object to transform input)Implements org. |
| iDefault | back to summary |
|---|---|
| private final Transformer<? super I, ? extends O> iDefault The default transformer to call if no tests match | |
| iPredicates | back to summary |
|---|---|
| private final Predicate<? super I>[] iPredicates The tests to consider | |
| iTransformers | back to summary |
|---|---|
| private final Transformer<? super I, ? extends O>[] iTransformers The matching transformers to call | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serial version UID | |
| SwitchTransformer | back to summary |
|---|---|
| private SwitchTransformer(final boolean clone, final Predicate<? super I>[] predicates, final Transformer<? super I, ? extends O>[] transformers, final Transformer<? super I, ? extends O> defaultTransformer) Hidden constructor for the use by the static factory methods.
| |
| SwitchTransformer | back to summary |
|---|---|
| public SwitchTransformer(final Predicate<? super I>[] predicates, final Transformer<? super I, ? extends O>[] transformers, final Transformer<? super I, ? extends O> defaultTransformer) Constructor that performs no validation.
Use
| |
| getDefaultTransformer | back to summary |
|---|---|
| public Transformer Gets the default transformer.
| |
| getPredicates | back to summary |
|---|---|
| public Predicate Gets the predicates.
| |
| getTransformers | back to summary |
|---|---|
| public Transformer Gets the transformers.
| |
| switchTransformer | back to summary |
|---|---|
| public static <I, O> Transformer Factory method that performs validation and copies the parameter arrays.
| |
| switchTransformer | back to summary |
|---|---|
| public static <I, O> Transformer Create a new Transformer that calls one of the transformers depending on the predicates. The Map consists of Predicate keys and Transformer values. A transformer is called if its matching predicate returns true. Each predicate is evaluated until one returns true. If no predicates evaluate to true, the default transformer is called. The default transformer is set in the map with a null key. The ordering is that of the iterator() method on the entryset collection of the map.
| |
| transform | back to summary |
|---|---|
| public O transform(final I input) Implements org. Transforms the input to result by calling the transformer whose matching predicate returns true.
| |