Class DefaultXmlConfig

java.lang.Object
org.ujorm.tools.xml.config.impl.DefaultXmlConfig
All Implemented Interfaces:
XmlConfig
Direct Known Subclasses:
DefaultHtmlConfig

public class DefaultXmlConfig extends Object implements XmlConfig
Configuration of HtmlPage
Author:
Pavel Ponec
  • Field Details

    • DEFAULT_INTENDATION

      public static final String DEFAULT_INTENDATION
      Default intendation per level
      See Also:
    • DEFAULT_NEW_LINE

      public static final String DEFAULT_NEW_LINE
      Default string or the new line
      See Also:
    • DEFAULT_FIRST_LEVEL

      public static final int DEFAULT_FIRST_LEVEL
      Default first level of intendation
      See Also:
    • REQUIRED_MSG

      public static final String REQUIRED_MSG
      Assertion message template
      See Also:
    • EMPTY

      public static final String EMPTY
      An empty String
      See Also:
    • doctype

      @Nullable protected @Nullable CharSequence doctype
      A header declaration of the document or a doctype
  • Constructor Details

    • DefaultXmlConfig

      public DefaultXmlConfig()
    • DefaultXmlConfig

      public DefaultXmlConfig(@NotNull @NotNull XmlConfig config)
      Copy attributes from other config
  • Method Details

    • getDoctype

      @NotNull public @NotNull CharSequence getDoctype()
      A header declaration of the document or a doctype
      Specified by:
      getDoctype in interface XmlConfig
    • nonnull

      @NotNull protected final <T> T nonnull(@Nullable T value, @NotNull T defaultValue)
    • setDoctype

      public DefaultXmlConfig setDoctype(@Nullable @Nullable CharSequence doctype)
      A header declaration of the document or a doctype
    • getCharset

      @NotNull public @NotNull Charset getCharset()
      Charset
      Specified by:
      getCharset in interface XmlConfig
      Returns:
      the charset
    • setCharset

      public DefaultXmlConfig setCharset(@NotNull @NotNull Charset charset)
      Charset
      Parameters:
      charset - the charset to set
    • setNiceFormat

      public final <T extends DefaultXmlConfig> T setNiceFormat()
      Assign parameters for a nice format of the HTML result
    • setNiceFormat

      public final <T extends DefaultXmlConfig> T setNiceFormat(@Nullable @Nullable CharSequence indentation)
      Assign parameters for a nice format of the HTML result
      Parameters:
      indentation - An empty String is replaced by a default intendation.
    • setCompressedFormat

      public final DefaultXmlConfig setCompressedFormat()
      Assign parameters for a compressed format of the HTML result
    • getFirstLevel

      public int getFirstLevel()
      Level of the root element, the value may be negative.
      Specified by:
      getFirstLevel in interface XmlConfig
      Returns:
      the firstLevel
    • setFirstLevel

      public DefaultXmlConfig setFirstLevel(int firstLevel)
      Level of the root element, the value may be negative.
      Parameters:
      firstLevel - the firstLevel to set
    • getIndentation

      @NotNull public @NotNull CharSequence getIndentation()
      An indentation space for elements of the next level, where default value is an empty `String`
      Specified by:
      getIndentation in interface XmlConfig
      Returns:
      the newLine
    • setIndentationSpace

      public DefaultXmlConfig setIndentationSpace(@NotNull @NotNull CharSequence indentation)
      An indentation space for elements of the next level, where default value is an empty `String`
    • getDefaultValue

      public CharSequence getDefaultValue()
      A replacement text instead of the null value
      Specified by:
      getDefaultValue in interface XmlConfig
    • getFormatter

      @NotNull public @NotNull Formatter getFormatter()
      A default implementation is: String.valueOf(value)
      Specified by:
      getFormatter in interface XmlConfig
    • setDefaultValue

      public DefaultXmlConfig setDefaultValue(@NotNull @NotNull String defaultValue)
      A replacement text instead of the null value
    • isCacheAllowed

      public boolean isCacheAllowed()
      Description copied from interface: XmlConfig
      HTTP cache is allowed
      Specified by:
      isCacheAllowed in interface XmlConfig
      Returns:
    • setCacheAllowed

      public DefaultXmlConfig setCacheAllowed(boolean cacheAllowed)
    • getNewLine

      public CharSequence getNewLine()
      A new line sequence
      Specified by:
      getNewLine in interface XmlConfig
    • setNewLine

      public DefaultXmlConfig setNewLine(@NotNull @NotNull CharSequence newLine)
      A new line sequence
    • setFormatter

      public DefaultXmlConfig setFormatter(@NotNull @NotNull Formatter formatter)
      A default value formatter is implemented by the method String.valueOf(value)