Package org.pkl.core

Class ValueRenderers

java.lang.Object
org.pkl.core.ValueRenderers

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

    • pcf

      public static ValueRenderer pcf(Writer writer, 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(Writer writer, 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(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(Writer writer, String indent)
      Creates a renderer for XML property lists.
    • properties

      public static ValueRenderer properties(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 rendered as Unicode escapes.