Package org.pkl.core

Class ValueRenderers


  • public final class ValueRenderers
    extends java.lang.Object
    Predefined ValueRenderers for Pcf, JSON, YAML, and XML property lists.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ValueRenderer json​(java.io.Writer writer, java.lang.String indent, boolean omitNullProperties)
      Creates a renderer for JSON.
      static ValueRenderer pcf​(java.io.Writer writer, java.lang.String indent, boolean omitNullProperties, boolean useCustomStringDelimiters)
      Creates a renderer for Pcf, a static subset of Pkl.
      static ValueRenderer plist​(java.io.Writer writer, java.lang.String indent)
      Creates a renderer for XML property lists.
      static ValueRenderer properties​(java.io.Writer writer, boolean omitNullProperties, boolean restrictCharset)
      Creates a renderer for Properties file format.
      static ValueRenderer yaml​(java.io.Writer writer, int indent, boolean omitNullProperties, boolean isStream)
      Creates a renderer for YAML.
      • Methods inherited from class java.lang.Object

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

      • pcf

        public static ValueRenderer pcf​(java.io.Writer writer,
                                        java.lang.String indent,
                                        boolean omitNullProperties,
                                        boolean useCustomStringDelimiters)
        Creates a renderer for Pcf, a static subset of Pkl. If omitNullProperties is true, object properties whose value is null will not be rendered. If useCustomDelimiters is true, custom string delimiters (such as #"..."#) are preferred over escaping quotes and backslashes.
      • json

        public static ValueRenderer json​(java.io.Writer writer,
                                         java.lang.String indent,
                                         boolean omitNullProperties)
        Creates a renderer for JSON. If omitNullProperties is true, object properties whose value is null will not be rendered.
      • yaml

        public static ValueRenderer yaml​(java.io.Writer writer,
                                         int indent,
                                         boolean omitNullProperties,
                                         boolean isStream)
        Creates a renderer for YAML. If omitNullProperties is true, object properties whose value is null will not be rendered. If isStream is true, ValueRenderer.renderDocument(java.lang.Object) expects an argument of type Iterable and renders it as YAML stream.
      • plist

        public static ValueRenderer plist​(java.io.Writer writer,
                                          java.lang.String indent)
        Creates a renderer for XML property lists.
      • properties

        public static ValueRenderer properties​(java.io.Writer writer,
                                               boolean omitNullProperties,
                                               boolean restrictCharset)
        Creates a renderer for Properties file format. If omitNullProperties is true, object properties and map entries whose value is null will not be rendered. If restrictCharset is true characters outside the printable US-ASCII charset range will be rendererd as Unicode escapes (see https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.3).