Class FreeMarkerWritable

  • All Implemented Interfaces:
    Writable
    Direct Known Subclasses:
    ModelElement

    public abstract class FreeMarkerWritable
    extends java.lang.Object
    implements Writable
    A Writable which uses the FreeMarker template engine to generate the output.
    • Nested Class Summary

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String getTemplateName()
      Returns the name of the template to be used for a specific writable type.
      protected java.lang.String getTemplateNameForClass​(java.lang.Class<?> clazz)
      Returns the name of the template to be used for a specific writable type.
      void write​(Writable.Context context, java.io.Writer writer)
      Writes this element to the given writer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FreeMarkerWritable

        public FreeMarkerWritable()
    • Method Detail

      • write

        public void write​(Writable.Context context,
                          java.io.Writer writer)
                   throws java.lang.Exception
        Description copied from interface: Writable
        Writes this element to the given writer.
        Specified by:
        write in interface Writable
        Parameters:
        context - Provides additional data specific to the used implementation of the serialization mechanism.
        writer - The writer to write this element to. Must not be closed by implementations.
        Throws:
        java.lang.Exception - in case of an error
      • getTemplateName

        protected java.lang.String getTemplateName()
        Returns the name of the template to be used for a specific writable type. By default, getTemplateNameForClass(Class) is called with getClass(), but this can be customized by overriding this method if required.
        Returns:
        the name of the template. Must not be null.
      • getTemplateNameForClass

        protected java.lang.String getTemplateNameForClass​(java.lang.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.