Class JavaCompressDirective

java.lang.Object
net.mcreator.generator.template.base.JavaCompressDirective
All Implemented Interfaces:
freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel

public class JavaCompressDirective extends Object implements freemarker.template.TemplateDirectiveModel
This directive captures the output generated inside its body (i.e., between its start-tag and end-tag) and reduces all unbroken white-space sequences to a single white-space character. The inserted character will be a line break if the replaced sequence contains line breaks, or a space otherwise. The very first and very last unbroken white-space sequences will be completely removed.

Compared to the built-in compress directive, this one does not compress inside double quotes (Java strings and multiline Java strings, but currently not for quotes inside multiline strings) to preserve the correct user string contents.

It is also slightly faster than the built-in compress directive.

  • Field Summary

    Fields inherited from interface freemarker.template.TemplateModel

    NOTHING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body)
     

    Methods inherited from class java.lang.Object

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

    • JavaCompressDirective

      public JavaCompressDirective()
  • Method Details

    • execute

      public void execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body) throws freemarker.template.TemplateException, IOException
      Specified by:
      execute in interface freemarker.template.TemplateDirectiveModel
      Throws:
      freemarker.template.TemplateException
      IOException