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
AWritable
which 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 String
getTemplateName()
Returns the name of the template to be used for a specific writable type.protected String
getTemplateNameForClass(Class<?> clazz)
Returns the name of the template to be used for a specific writable type.void
write(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:Writable
Writes 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*.ftl
is used as template file name.- Parameters:
clazz
- class to obtain a template for- Returns:
- the name of the template. Must not be
null
.
-
-