Class BaseConstant

All Implemented Interfaces:
io.github.mmm.code.api.expression.CodeConstant, io.github.mmm.code.api.expression.CodeExpression, io.github.mmm.code.api.item.CodeItem

public class BaseConstant extends BaseExpression implements io.github.mmm.code.api.expression.CodeConstant
Base or dummy implementation of CodeConstant.
Since:
1.0.0
  • Constructor Details

    • BaseConstant

      public BaseConstant(String value)
      The constructor.
      Parameters:
      value - the raw value as source code string (e.g. "1L" or "\"text\"").
  • Method Details

    • getValue

      public Object getValue()
      Specified by:
      getValue in interface io.github.mmm.code.api.expression.CodeConstant
    • doWrite

      protected void doWrite(Appendable sink, String newline, String defaultIndent, String currentIndent, io.github.mmm.code.api.language.CodeLanguage language) throws IOException
      Specified by:
      doWrite in class BaseItem
      Parameters:
      sink - the Appendable where to append the code from this CodeItem.
      newline - the newline String.
      defaultIndent - the String used for indentation (e.g. a number of spaces to insert per indent level).
      currentIndent - the current indent (number of spaces). Initially the empty string (""). Before a recursion the defaultIndent will be appended.
      language - the CodeLanguage to use.
      Throws:
      IOException - if thrown by Appendable.
      See Also:
      • CodeItem.write(Appendable, String, String)