com.typesafe.config
Class ConfigParseOptions

java.lang.Object
  extended by com.typesafe.config.ConfigParseOptions

public final class ConfigParseOptions
extends java.lang.Object

A set of options related to parsing.

This object is immutable, so the "setters" return a new object.

Here is an example of creating a custom ConfigParseOptions:

     ConfigParseOptions options = ConfigParseOptions.defaults()
         .setSyntax(ConfigSyntax.JSON)
         .setAllowMissing(false)
 


Method Summary
 ConfigParseOptions appendIncluder(ConfigIncluder includer)
           
static ConfigParseOptions defaults()
           
 boolean getAllowMissing()
           
 java.lang.ClassLoader getClassLoader()
          Get the class loader; never returns null, if the class loader was unset, returns Thread.currentThread().getContextClassLoader().
 ConfigIncluder getIncluder()
           
 java.lang.String getOriginDescription()
           
 ConfigSyntax getSyntax()
           
 ConfigParseOptions prependIncluder(ConfigIncluder includer)
           
 ConfigParseOptions setAllowMissing(boolean allowMissing)
          Set to false to throw an exception if the item being parsed (for example a file) is missing.
 ConfigParseOptions setClassLoader(java.lang.ClassLoader loader)
          Set the class loader.
 ConfigParseOptions setIncluder(ConfigIncluder includer)
          Set a ConfigIncluder which customizes how includes are handled.
 ConfigParseOptions setOriginDescription(java.lang.String originDescription)
          Set a description for the thing being parsed.
 ConfigParseOptions setSyntax(ConfigSyntax syntax)
          Set the file format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

defaults

public static ConfigParseOptions defaults()

setSyntax

public ConfigParseOptions setSyntax(ConfigSyntax syntax)
Set the file format. If set to null, try to guess from any available filename extension; if guessing fails, assume ConfigSyntax.CONF.

Parameters:
syntax - a syntax or null for best guess
Returns:
options with the syntax set

getSyntax

public ConfigSyntax getSyntax()

setOriginDescription

public ConfigParseOptions setOriginDescription(java.lang.String originDescription)
Set a description for the thing being parsed. In most cases this will be set up for you to something like the filename, but if you provide just an input stream you might want to improve on it. Set to null to allow the library to come up with something automatically. This description is the basis for the ConfigOrigin of the parsed values.

Parameters:
originDescription -
Returns:
options with the origin description set

getOriginDescription

public java.lang.String getOriginDescription()

setAllowMissing

public ConfigParseOptions setAllowMissing(boolean allowMissing)
Set to false to throw an exception if the item being parsed (for example a file) is missing. Set to true to just return an empty document in that case.

Parameters:
allowMissing -
Returns:
options with the "allow missing" flag set

getAllowMissing

public boolean getAllowMissing()

setIncluder

public ConfigParseOptions setIncluder(ConfigIncluder includer)
Set a ConfigIncluder which customizes how includes are handled.

Parameters:
includer -
Returns:
new version of the parse options with different includer

prependIncluder

public ConfigParseOptions prependIncluder(ConfigIncluder includer)

appendIncluder

public ConfigParseOptions appendIncluder(ConfigIncluder includer)

getIncluder

public ConfigIncluder getIncluder()

setClassLoader

public ConfigParseOptions setClassLoader(java.lang.ClassLoader loader)
Set the class loader. If set to null, Thread.currentThread().getContextClassLoader() will be used.

Parameters:
loader - a class loader or null to use thread context class loader
Returns:
options with the class loader set

getClassLoader

public java.lang.ClassLoader getClassLoader()
Get the class loader; never returns null, if the class loader was unset, returns Thread.currentThread().getContextClassLoader().

Returns:
class loader to use