Transformer

public abstract interface demo.Transformer<T>[source]

A generic transformation contract.

Parameters:

<T> – input and output type

Methods

convert(Object)

Transforms a value using Widget#convert(int) when needed.

twice(Object)

Transforms a value twice.

public abstract T convert(T input) throws IllegalArgumentException[source]

Transforms a value using Widget#convert(int) when needed.

The result preserves <angle brackets>.

Parameters:

input – the value to transform

Returns:

the transformed value

Throws:

java.lang.IllegalArgumentException – if the value is invalid

if the value is empty

public default T twice(T input)[source]

Transforms a value twice.

API Note:

Use this when one pass is not enough.

Implementation Requirements:

The default implementation calls #convert(Object) twice.

Implementation Note:

This implementation does not cache the first result.

Parameters:

input – the value to transform

Returns:

the twice transformed value