Package org.mapstruct.ap.internal.writer
Class FreeMarkerWritable
- java.lang.Object
-
- org.mapstruct.ap.internal.writer.FreeMarkerWritable
-
- All Implemented Interfaces:
Writable
- Direct Known Subclasses:
ModelElement
public abstract class FreeMarkerWritable extends Object implements Writable
AWritablewhich uses the FreeMarker template engine to generate the output.- Author:
- Gunnar Morling
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mapstruct.ap.internal.writer.Writable
Writable.Context
-
-
Constructor Summary
Constructors Constructor Description FreeMarkerWritable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetTemplateName()Returns the name of the template to be used for a specific writable type.protected StringgetTemplateNameForClass(Class<?> clazz)Returns the name of the template to be used for a specific writable type.voidwrite(Writable.Context context, Writer writer)Writes this element to the given writer.
-
-
-
Method Detail
-
write
public void write(Writable.Context context, Writer writer) throws Exception
Description copied from interface:WritableWrites this element to the given writer.
-
getTemplateName
protected String getTemplateName()
Returns the name of the template to be used for a specific writable type. By default,getTemplateNameForClass(Class)is called withgetClass(), but this can be customized by overriding this method if required.- Returns:
- the name of the template. Must not be
null.
-
getTemplateNameForClass
protected String getTemplateNameForClass(Class<?> clazz)
Returns the name of the template to be used for a specific writable type. By default, the package directory and the class name of the given model element type, appended with the extension*.ftlis used as template file name.- Parameters:
clazz- class to obtain a template for- Returns:
- the name of the template. Must not be
null.
-
-