Class DefaultMustache

java.lang.Object
com.github.mustachejava.codes.DefaultCode
com.github.mustachejava.codes.DefaultMustache
All Implemented Interfaces:
Code, Mustache, Cloneable

public class DefaultMustache extends DefaultCode implements Mustache
Default Mustache
  • Field Details

    • codes

      private Code[] codes
    • inited

      private boolean inited
    • isRecursive

      private boolean isRecursive
  • Constructor Details

  • Method Details

    • getCodes

      public Code[] getCodes()
      Description copied from interface: Mustache
      Get the underlying code objects.
      Specified by:
      getCodes in interface Code
      Specified by:
      getCodes in interface Mustache
      Overrides:
      getCodes in class DefaultCode
      Returns:
      the array of child codes
    • run

      public Writer run(Writer writer, List<Object> scopes)
      Description copied from interface: Mustache
      Only executes the codes. Does not append the text.
      Specified by:
      run in interface Mustache
      Overrides:
      run in class DefaultCode
      Parameters:
      writer - write the output of the executed template here
      scopes - the array of scopes to execute
      Returns:
      the replacement writer
    • invert

      public Node invert(String text)
      Description copied from interface: Mustache
      Invert this mustache given output text.
      Specified by:
      invert in interface Mustache
      Parameters:
      text - the text to parse
      Returns:
      a tree of nodes representing the variables that when passed as a scope would reproduce the text
    • setCodes

      public void setCodes(Code[] newcodes)
      Description copied from interface: Mustache
      Change the underlying codes of the mustache implementation.
      Specified by:
      setCodes in interface Code
      Specified by:
      setCodes in interface Mustache
      Overrides:
      setCodes in class DefaultCode
      Parameters:
      newcodes - set the children of this code
    • execute

      public Writer execute(Writer writer, List<Object> scopes)
      Description copied from class: DefaultCode
      The default behavior is to run the codes and append the captured text.
      Specified by:
      execute in interface Code
      Specified by:
      execute in interface Mustache
      Overrides:
      execute in class DefaultCode
      Parameters:
      writer - The writer to write the output to
      scopes - The scopes to evaluate the embedded names against.
      Returns:
      the new writer
    • identity

      public void identity(Writer writer)
      Description copied from interface: Mustache
      Execute the mustache to output itself.
      Specified by:
      identity in interface Code
      Specified by:
      identity in interface Mustache
      Overrides:
      identity in class DefaultCode
      Parameters:
      writer - write the output of the executed template here
    • init

      public void init()
      Description copied from interface: Mustache
      Initialize the mustache before executing. This is must be called at least once and is normally called already by the time you have a mustache instance.
      Specified by:
      init in interface Code
      Specified by:
      init in interface Mustache
      Overrides:
      init in class DefaultCode
    • isRecursive

      public boolean isRecursive()
    • setRecursive

      public void setRecursive()