Top Description Fields Constructors Methods
com.typesafe.config

public final Class ConfigRenderOptions

extends Object
Class Inheritance

A set of options related to rendering a ConfigValue. Passed to ConfigValue#render(ConfigRenderOptions).

Here is an example of creating a ConfigRenderOptions:

    ConfigRenderOptions options =
        ConfigRenderOptions.defaults().setComments(false)

Field Summary

Modifier and TypeField and Description
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean

Constructor Summary

AccessConstructor and Description
private
ConfigRenderOptions(boolean originComments, boolean comments, boolean formatted, boolean json, boolean showEnvVariableValues)

Method Summary

Modifier and TypeMethod and Description
public static ConfigRenderOptions

Returns:

the concise render options
concise
()

Returns concise render options (no whitespace or comments).

public static ConfigRenderOptions

Returns:

the default render options
defaults
()

Returns the default render options which are verbose (commented and formatted).

public boolean

Returns:

true if comments should be rendered
getComments
()

Returns whether the options enable comments.

public boolean

Returns:

true if the options enable formatting
getFormatted
()

Returns whether the options enable formatting.

public boolean

Returns:

true if only JSON should be rendered
getJson
()

Returns whether the options enable JSON.

public boolean

Returns:

true if origin comments should be rendered
getOriginComments
()

Returns whether the options enable automated origin comments.

public boolean

Returns:

true if environment variable values should be rendered
getShowEnvVariableValues
()

Returns whether the options enable rendering of environment variable values.

public ConfigRenderOptions

Returns:

options with requested setting for comments
setComments
(boolean
true to include comments in the render
value
)

Returns options with comments toggled.

public ConfigRenderOptions

Returns:

options with requested setting for formatting
setFormatted
(boolean
true to enable formatting
value
)

Returns options with formatting toggled.

public ConfigRenderOptions

Returns:

options with requested setting for JSON
setJson
(boolean
true to include non-JSON extensions in the render
value
)

Returns options with JSON toggled.

public ConfigRenderOptions

Returns:

options with origin comments toggled
setOriginComments
(boolean
true to include autogenerated setting-origin comments in the render
value
)

Returns options with origin comments toggled.

public ConfigRenderOptions

Returns:

options with requested setting for environment variables
setShowEnvVariableValues
(boolean
true to include environment variable values in the render
value
)

Returns options with showEnvVariableValues toggled.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

commentsback to summary
private final boolean comments
formattedback to summary
private final boolean formatted
jsonback to summary
private final boolean json
originCommentsback to summary
private final boolean originComments
showEnvVariableValuesback to summary
private final boolean showEnvVariableValues

Constructor Detail

ConfigRenderOptionsback to summary
private ConfigRenderOptions(boolean originComments, boolean comments, boolean formatted, boolean json, boolean showEnvVariableValues)

Method Detail

conciseback to summary
public static ConfigRenderOptions concise()

Returns concise render options (no whitespace or comments). For a resolved Config, the concise rendering will be valid JSON.

Returns:ConfigRenderOptions

the concise render options

defaultsback to summary
public static ConfigRenderOptions defaults()

Returns the default render options which are verbose (commented and formatted). See ConfigRenderOptions#concise for stripped-down options. This rendering will not be valid JSON since it has comments.

Returns:ConfigRenderOptions

the default render options

getCommentsback to summary
public boolean getComments()

Returns whether the options enable comments. This method is mostly used by the config lib internally, not by applications.

Returns:boolean

true if comments should be rendered

getFormattedback to summary
public boolean getFormatted()

Returns whether the options enable formatting. This method is mostly used by the config lib internally, not by applications.

Returns:boolean

true if the options enable formatting

getJsonback to summary
public boolean getJson()

Returns whether the options enable JSON. This method is mostly used by the config lib internally, not by applications.

Returns:boolean

true if only JSON should be rendered

getOriginCommentsback to summary
public boolean getOriginComments()

Returns whether the options enable automated origin comments. This method is mostly used by the config lib internally, not by applications.

Returns:boolean

true if origin comments should be rendered

getShowEnvVariableValuesback to summary
public boolean getShowEnvVariableValues()

Returns whether the options enable rendering of environment variable values. This method is mostly used by the config lib internally, not by applications.

Returns:boolean

true if environment variable values should be rendered

setCommentsback to summary
public ConfigRenderOptions setComments(boolean value)

Returns options with comments toggled. This controls human-written comments but not the autogenerated "origin of this setting" comments, which are controlled by ConfigRenderOptions#setOriginComments.

Parameters
value:boolean

true to include comments in the render

Returns:ConfigRenderOptions

options with requested setting for comments

setFormattedback to summary
public ConfigRenderOptions setFormatted(boolean value)

Returns options with formatting toggled. Formatting means indentation and whitespace, enabling formatting makes things prettier but larger.

Parameters
value:boolean

true to enable formatting

Returns:ConfigRenderOptions

options with requested setting for formatting

setJsonback to summary
public ConfigRenderOptions setJson(boolean value)

Returns options with JSON toggled. JSON means that HOCON extensions (omitting commas, quotes for example) won't be used. However, whether to use comments is controlled by the separate setComments(boolean) and setOriginComments(boolean) options. So if you enable comments you will get invalid JSON despite setting this to true.

Parameters
value:boolean

true to include non-JSON extensions in the render

Returns:ConfigRenderOptions

options with requested setting for JSON

setOriginCommentsback to summary
public ConfigRenderOptions setOriginComments(boolean value)

Returns options with origin comments toggled. If this is enabled, the library generates comments for each setting based on the ConfigValue#origin of that setting's value. For example these comments might tell you which file a setting comes from.

setOriginComments() controls only these autogenerated "origin of this setting" comments, to toggle regular comments use ConfigRenderOptions#setComments.

Parameters
value:boolean

true to include autogenerated setting-origin comments in the render

Returns:ConfigRenderOptions

options with origin comments toggled

setShowEnvVariableValuesback to summary
public ConfigRenderOptions setShowEnvVariableValues(boolean value)

Returns options with showEnvVariableValues toggled. This controls if values set from environment variables are included in the rendered string.

Parameters
value:boolean

true to include environment variable values in the render

Returns:ConfigRenderOptions

options with requested setting for environment variables

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override