BeanIO 2.0.4

org.beanio.internal.util
Class Settings

java.lang.Object
  extended by org.beanio.internal.util.Settings

public class Settings
extends Object

Settings is used to load and store BeanIO configuration settings. All settings are global within the JVM (or actually the class loader).

Default BeanIO settings can be overridden using a property file named beanio.properties The file will be loaded from the current working directory or from anywhere on the classpath. The default configuration filename can be overridden using the System property org.beanio.configuration.

Configuration settings can be further overridden by any System property of the same name when the configuration file is loaded.

Since:
1.0
Author:
Kevin Seim

Field Summary
static String CREATE_MISSING_BEANS
          Whether version 2.0.0 style unmarshalling should be supported which instantiates bean objects for missing fields and records during unmarshalling.
static String DEFAULT_DATE_FORMAT
          The default date format pattern for fields assigned type alias Date
static String DEFAULT_DATETIME_FORMAT
          The default date format pattern for fields assigned type alias DateTime or of type java.util.Date
static String DEFAULT_FIELD_MIN_OCCURS
          The default minOccurs setting for a field (after appending the stream format)
static String DEFAULT_GROUP_MIN_OCCURS
          The default minOccurs setting for a group.
static String DEFAULT_MARSHALLING_ENABLED
          Whether a configured field default is marshalled for null property values.
static String DEFAULT_RECORD_MIN_OCCURS
          The default minOccurs setting for a record.
static String DEFAULT_TIME_FORMAT
          The default date format pattern for fields assigned type alias Time
static String DEFAULT_XML_TYPE
          The default XML type for a field definition, set to element or attribute.
static String DEFAULT_XSI_NAMESPACE_PREFIX
          The default namespace prefix for 'http://www.w3.org/2001/XMLSchema-instance'
static String NULL_ESCAPING_ENABLED
          Whether the null character can be escaped using \0 when property escaping is enabled.
static String PROPERTY_ACCESSOR_METHOD
          The method of property access to use, 'reflection' (default) or 'asm' is supported
static String PROPERTY_ESCAPING_ENABLED
          Whether property values support the following escape sequences: \\ - Backslash \n - Line Feed \r - Carriage Return \t - Tab \f - Form Feed \0 - Null
static String PROPERTY_SUBSTITUTION_ENABLED
          Whether property substitution is enabled for mapping files
static String STREAM_FACTORY_CLASS
          This property is set to the fully qualified class name of the default stream factory implementation
static String XML_WRITER_UPDATE_STATE_USING_DELTA
          Used for Spring Batch integration.
 
Method Summary
 boolean getBoolean(String key)
          Returns the boolean value of a BeanIO configuration setting.
static Settings getInstance()
          Returns the Settings instance.
static Settings getInstance(ClassLoader classLoader)
          Returns the Settings instance.
 int getInt(String key, int defaultValue)
          Returns a BeanIO configuration setting as an integer.
 String getProperty(String key)
          Returns a BeanIO configuration setting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STREAM_FACTORY_CLASS

public static final String STREAM_FACTORY_CLASS
This property is set to the fully qualified class name of the default stream factory implementation

See Also:
Constant Field Values

DEFAULT_DATE_FORMAT

public static final String DEFAULT_DATE_FORMAT
The default date format pattern for fields assigned type alias Date

See Also:
Constant Field Values

DEFAULT_DATETIME_FORMAT

public static final String DEFAULT_DATETIME_FORMAT
The default date format pattern for fields assigned type alias DateTime or of type java.util.Date

See Also:
Constant Field Values

DEFAULT_TIME_FORMAT

public static final String DEFAULT_TIME_FORMAT
The default date format pattern for fields assigned type alias Time

See Also:
Constant Field Values

PROPERTY_ESCAPING_ENABLED

public static final String PROPERTY_ESCAPING_ENABLED
Whether property values support the following escape sequences:

A backslash preceding any other character is ignored.

Set to false to disable.

Since:
1.2
See Also:
Constant Field Values

NULL_ESCAPING_ENABLED

public static final String NULL_ESCAPING_ENABLED
Whether the null character can be escaped using \0 when property escaping is enabled.

See Also:
Constant Field Values

PROPERTY_SUBSTITUTION_ENABLED

public static final String PROPERTY_SUBSTITUTION_ENABLED
Whether property substitution is enabled for mapping files

See Also:
Constant Field Values

DEFAULT_XML_TYPE

public static final String DEFAULT_XML_TYPE
The default XML type for a field definition, set to element or attribute.

See Also:
Constant Field Values

DEFAULT_XSI_NAMESPACE_PREFIX

public static final String DEFAULT_XSI_NAMESPACE_PREFIX
The default namespace prefix for 'http://www.w3.org/2001/XMLSchema-instance'

See Also:
Constant Field Values

XML_WRITER_UPDATE_STATE_USING_DELTA

public static final String XML_WRITER_UPDATE_STATE_USING_DELTA
Used for Spring Batch integration. Set to 'true' to have the XmlWriter only update the execution context (state) with changes since the last update. At the time of writing, it's not known whether Spring Batch will create a new ExecutionContext every time state is updated, or if the current context is used. Disabled by default until proven the optimization will not impact state updates.

See Also:
Constant Field Values

DEFAULT_MARSHALLING_ENABLED

public static final String DEFAULT_MARSHALLING_ENABLED
Whether a configured field default is marshalled for null property values. The default configuration sets this property to true.

Since:
1.2.2
See Also:
Constant Field Values

DEFAULT_GROUP_MIN_OCCURS

public static final String DEFAULT_GROUP_MIN_OCCURS
The default minOccurs setting for a group.

See Also:
Constant Field Values

DEFAULT_RECORD_MIN_OCCURS

public static final String DEFAULT_RECORD_MIN_OCCURS
The default minOccurs setting for a record.

See Also:
Constant Field Values

DEFAULT_FIELD_MIN_OCCURS

public static final String DEFAULT_FIELD_MIN_OCCURS
The default minOccurs setting for a field (after appending the stream format)

See Also:
Constant Field Values

PROPERTY_ACCESSOR_METHOD

public static final String PROPERTY_ACCESSOR_METHOD
The method of property access to use, 'reflection' (default) or 'asm' is supported

See Also:
Constant Field Values

CREATE_MISSING_BEANS

public static final String CREATE_MISSING_BEANS
Whether version 2.0.0 style unmarshalling should be supported which instantiates bean objects for missing fields and records during unmarshalling. This behavior is not recommended.

See Also:
Constant Field Values
Method Detail

getProperty

public String getProperty(String key)
Returns a BeanIO configuration setting.

Parameters:
key - the name of the setting
Returns:
the value of the setting, or null if the name is invalid

getBoolean

public boolean getBoolean(String key)
Returns the boolean value of a BeanIO configuration setting.

Parameters:
key - the property key
Returns:
true if the property value is "true" (case insensitive), or false if the property is any other value

getInt

public int getInt(String key,
                  int defaultValue)
Returns a BeanIO configuration setting as an integer.

Parameters:
key - the property key
defaultValue - the default value if the setting wasn't configured or invalid
Returns:
the int property value or defaultValue

getInstance

public static Settings getInstance()
Returns the Settings instance.

Returns:
the Settings

getInstance

public static Settings getInstance(ClassLoader classLoader)
Returns the Settings instance.

Parameters:
classLoader - the ClassLoader to use for loading classpath resources
Returns:
the Settings
Since:
2.0

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim