@Test @SuppressWarnings("unchecked") public void testChainedTransformer() { final Transformer<Object, Object> a = TransformerUtils.<Object, Object>constantTransformer("A"); final Transformer<Object, Object> b = TransformerUtils.constantTransformer((Object) "B"); assertEquals("A", TransformerUtils.chainedTransformer(b, a).transform(null)); assertEquals("B", TransformerUtils.chainedTransformer(a, b).transform(null)); assertEquals("A", TransformerUtils.chainedTransformer(new Transformer[] { b, a }).transform(null)); Collection<Transformer<Object, Object>> coll = new ArrayList<Transformer<Object, Object>>(); coll.add(b); coll.add(a); assertEquals("A", TransformerUtils.chainedTransformer(coll).transform(null)); assertSame(NOPTransformer.INSTANCE, TransformerUtils.chainedTransformer(new Transformer[0])); assertSame(NOPTransformer.INSTANCE, TransformerUtils.chainedTransformer(Collections.<Transformer<Object, Object>>emptyList())); try { TransformerUtils.chainedTransformer(null, null); fail(); } catch (final NullPointerException ex) {} try { TransformerUtils.chainedTransformer((Transformer[]) null); fail(); } catch (final NullPointerException ex) {} try { TransformerUtils.chainedTransformer((Collection<Transformer<Object, Object>>) null); fail(); } catch (final NullPointerException ex) {} try { TransformerUtils.chainedTransformer(new Transformer[] {null, null}); fail(); } catch (final NullPointerException ex) {} try { coll = new ArrayList<Transformer<Object, Object>>(); coll.add(null); coll.add(null); TransformerUtils.chainedTransformer(coll); fail(); } catch (final NullPointerException ex) {} }
public static <T> Transformer<T, T> chainedTransformer( final Transformer<? super T, ? extends T>... transformers) { return ChainedTransformer.chainedTransformer(transformers); }
TransformerUtils { public static <T> Transformer<T, T> chainedTransformer( final Transformer<? super T, ? extends T>... transformers) { return ChainedTransformer.chainedTransformer(transformers); } }
TransformerUtils { public static <T> Transformer<T, T> chainedTransformer( final Transformer<? super T, ? extends T>... transformers) { return ChainedTransformer.chainedTransformer(transformers); } private  TransformerUtils(); }
TransformerUtils { public static <T> Transformer<T, T> chainedTransformer( final Transformer<? super T, ? extends T>... transformers) { return ChainedTransformer.chainedTransformer(transformers); } private  TransformerUtils(); static Transformer<I, O> exceptionTransformer(); static Transformer<I, O> nullTransformer(); static Transformer<T, T> nopTransformer(); static Transformer<T, T> cloneTransformer(); static Transformer<I, O> constantTransformer(final O constantToReturn); static Transformer<T, T> asTransformer(final Closure<? super T> closure); static Transformer<T, Boolean> asTransformer(final Predicate<? super T> predicate); static Transformer<I, O> asTransformer(final Factory<? extends O> factory); static Transformer<T, T> chainedTransformer(
            final Transformer<? super T, ? extends T>... transformers); static Transformer<T, T> chainedTransformer(
            final Collection<? extends Transformer<? super T, ? extends T>> transformers); static Transformer<T, T> ifTransformer(final Predicate<? super T> predicate,
                                                      final Transformer<? super T, ? extends T> trueTransformer); static Transformer<I, O> ifTransformer(final Predicate<? super I> predicate,
                                                         final Transformer<? super I, ? extends O> trueTransformer,
                                                         final Transformer<? super I, ? extends O> falseTransformer); @SuppressWarnings("unchecked") @Deprecated static Transformer<I, O> switchTransformer(final Predicate<? super I> predicate,
            final Transformer<? super I, ? extends O> trueTransformer,
            final Transformer<? super I, ? extends O> falseTransformer); static Transformer<I, O> switchTransformer(final Predicate<? super I>[] predicates,
            final Transformer<? super I, ? extends O>[] transformers); static Transformer<I, O> switchTransformer(final Predicate<? super I>[] predicates,
            final Transformer<? super I, ? extends O>[] transformers,
            final Transformer<? super I, ? extends O> defaultTransformer); static Transformer<I, O> switchTransformer(
            final Map<Predicate<I>, Transformer<I, O>> predicatesAndTransformers); @SuppressWarnings("unchecked") static Transformer<I, O> switchMapTransformer(
            final Map<I, Transformer<I, O>> objectsAndTransformers); static Transformer<Class<? extends T>, T> instantiateTransformer(); static Transformer<Class<? extends T>, T> instantiateTransformer(
            final Class<?>[] paramTypes, final Object[] args); static Transformer<I, O> mapTransformer(final Map<? super I, ? extends O> map); static Transformer<I, O> invokerTransformer(final String methodName); static Transformer<I, O> invokerTransformer(final String methodName, final Class<?>[] paramTypes,
                                                              final Object[] args); static Transformer<T, String> stringValueTransformer(); }
TransformerUtils { public static <T> Transformer<T, T> chainedTransformer( final Transformer<? super T, ? extends T>... transformers) { return ChainedTransformer.chainedTransformer(transformers); } private  TransformerUtils(); static Transformer<I, O> exceptionTransformer(); static Transformer<I, O> nullTransformer(); static Transformer<T, T> nopTransformer(); static Transformer<T, T> cloneTransformer(); static Transformer<I, O> constantTransformer(final O constantToReturn); static Transformer<T, T> asTransformer(final Closure<? super T> closure); static Transformer<T, Boolean> asTransformer(final Predicate<? super T> predicate); static Transformer<I, O> asTransformer(final Factory<? extends O> factory); static Transformer<T, T> chainedTransformer(
            final Transformer<? super T, ? extends T>... transformers); static Transformer<T, T> chainedTransformer(
            final Collection<? extends Transformer<? super T, ? extends T>> transformers); static Transformer<T, T> ifTransformer(final Predicate<? super T> predicate,
                                                      final Transformer<? super T, ? extends T> trueTransformer); static Transformer<I, O> ifTransformer(final Predicate<? super I> predicate,
                                                         final Transformer<? super I, ? extends O> trueTransformer,
                                                         final Transformer<? super I, ? extends O> falseTransformer); @SuppressWarnings("unchecked") @Deprecated static Transformer<I, O> switchTransformer(final Predicate<? super I> predicate,
            final Transformer<? super I, ? extends O> trueTransformer,
            final Transformer<? super I, ? extends O> falseTransformer); static Transformer<I, O> switchTransformer(final Predicate<? super I>[] predicates,
            final Transformer<? super I, ? extends O>[] transformers); static Transformer<I, O> switchTransformer(final Predicate<? super I>[] predicates,
            final Transformer<? super I, ? extends O>[] transformers,
            final Transformer<? super I, ? extends O> defaultTransformer); static Transformer<I, O> switchTransformer(
            final Map<Predicate<I>, Transformer<I, O>> predicatesAndTransformers); @SuppressWarnings("unchecked") static Transformer<I, O> switchMapTransformer(
            final Map<I, Transformer<I, O>> objectsAndTransformers); static Transformer<Class<? extends T>, T> instantiateTransformer(); static Transformer<Class<? extends T>, T> instantiateTransformer(
            final Class<?>[] paramTypes, final Object[] args); static Transformer<I, O> mapTransformer(final Map<? super I, ? extends O> map); static Transformer<I, O> invokerTransformer(final String methodName); static Transformer<I, O> invokerTransformer(final String methodName, final Class<?>[] paramTypes,
                                                              final Object[] args); static Transformer<T, String> stringValueTransformer();  }