Package com.typesafe.config
Class ConfigRenderOptions
- java.lang.Object
-
- com.typesafe.config.ConfigRenderOptions
-
public final class ConfigRenderOptions extends java.lang.Object
A set of options related to rendering a
ConfigValue. Passed toConfigValue.render(ConfigRenderOptions).Here is an example of creating a
ConfigRenderOptions:ConfigRenderOptions options = ConfigRenderOptions.defaults().setComments(false)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConfigRenderOptionsconcise()Returns concise render options (no whitespace or comments).static ConfigRenderOptionsdefaults()Returns the default render options which are verbose (commented and formatted).booleangetComments()Returns whether the options enable comments.booleangetFormatted()Returns whether the options enable formatting.booleangetJson()Returns whether the options enable JSON.booleangetOriginComments()Returns whether the options enable automated origin comments.booleangetShowEnvVariableValues()Returns whether the options enable rendering of environment variable values.ConfigRenderOptionssetComments(boolean value)Returns options with comments toggled.ConfigRenderOptionssetFormatted(boolean value)Returns options with formatting toggled.ConfigRenderOptionssetJson(boolean value)Returns options with JSON toggled.ConfigRenderOptionssetOriginComments(boolean value)Returns options with origin comments toggled.ConfigRenderOptionssetShowEnvVariableValues(boolean value)Returns options with showEnvVariableValues toggled.java.lang.StringtoString()
-
-
-
Method Detail
-
defaults
public static defaults()
Returns the default render options which are verbose (commented and formatted). Seeconcise()for stripped-down options. This rendering will not be valid JSON since it has comments.- Returns:
- the default render options
-
concise
public static concise()
Returns concise render options (no whitespace or comments). For a resolvedConfig, the concise rendering will be valid JSON.- Returns:
- the concise render options
-
setComments
public 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 bysetOriginComments(boolean).- Parameters:
value- true to include comments in the render- Returns:
- options with requested setting for comments
-
getComments
public boolean getComments()
Returns whether the options enable comments. This method is mostly used by the config lib internally, not by applications.- Returns:
- true if comments should be rendered
-
setOriginComments
public setOriginComments(boolean value)
Returns options with origin comments toggled. If this is enabled, the library generates comments for each setting based on theConfigValue.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 usesetComments(boolean).- Parameters:
value- true to include autogenerated setting-origin comments in the render- Returns:
- options with origin comments toggled
-
getOriginComments
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:
- true if origin comments should be rendered
-
setFormatted
public setFormatted(boolean value)
Returns options with formatting toggled. Formatting means indentation and whitespace, enabling formatting makes things prettier but larger.- Parameters:
value- true to enable formatting- Returns:
- options with requested setting for formatting
-
getFormatted
public boolean getFormatted()
Returns whether the options enable formatting. This method is mostly used by the config lib internally, not by applications.- Returns:
- true if the options enable formatting
-
setJson
public 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 separatesetComments(boolean)andsetOriginComments(boolean)options. So if you enable comments you will get invalid JSON despite setting this to true.- Parameters:
value- true to include non-JSON extensions in the render- Returns:
- options with requested setting for JSON
-
setShowEnvVariableValues
public setShowEnvVariableValues(boolean value)
Returns options with showEnvVariableValues toggled. This controls if values set from environment variables are included in the rendered string.- Parameters:
value- true to include environment variable values in the render- Returns:
- options with requested setting for environment variables
-
getShowEnvVariableValues
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:
- true if environment variable values should be rendered
-
getJson
public boolean getJson()
Returns whether the options enable JSON. This method is mostly used by the config lib internally, not by applications.- Returns:
- true if only JSON should be rendered
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-