-
- All Known Implementing Classes:
StandardTransformFactory
public interface TransformFactoryDifferentTransformimplementations can be installed in theTransformFactoryto be instantiated when needed. The transforms are ordered in a graph-like manner so that all tranforms leading away from a particular model type easily can be located.- Since:
- 2.0
- Author:
- Emil Forslund
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <A,T extends Transform<A,?>>
Set<Map.Entry<Class<?>,T>>allFrom(Class<A> from)Builds a stream of all transforms that match the specified model.StringgetName()Returns a unique name of this factory.<A,B,T extends Transform<A,B>>
TransformFactoryinstall(Class<A> from, Class<B> to, Supplier<T> transformer)Installs the specifiedTransform.default <A,T extends Transform<A,String>>
TransformFactoryinstall(Class<A> from, Supplier<T> transformer)Installs the specifiedTransform, assuming that the resulting class is a String.
-
-
-
Method Detail
-
getName
String getName()
Returns a unique name of this factory. This can be used to identify a particular factory if multiple ones are used in the same generator.- Returns:
- the unique name
-
install
default <A,T extends Transform<A,String>> TransformFactory install(Class<A> from, Supplier<T> transformer)
Installs the specifiedTransform, assuming that the resulting class is a String.- Type Parameters:
A- the type to transform fromT- the transformer- Parameters:
from- the modeltransformer- the view- Returns:
- a reference to this
-
install
<A,B,T extends Transform<A,B>> TransformFactory install(Class<A> from, Class<B> to, Supplier<T> transformer)
Installs the specifiedTransform.- Type Parameters:
A- the type to transform fromB- the type to transform toT- the transformer- Parameters:
from- the model class to transform fromto- the model class to transform totransformer- the view- Returns:
- a reference to this
-
allFrom
<A,T extends Transform<A,?>> Set<Map.Entry<Class<?>,T>> allFrom(Class<A> from)
Builds a stream of all transforms that match the specified model.- Type Parameters:
A- the class to transform fromT- the transformer- Parameters:
from- the model class to transform from- Returns:
- a stream of all matching transforms
-
-