BeanIO 2.0.4

org.beanio.internal.config
Class StreamConfig

java.lang.Object
  extended by org.beanio.internal.util.TreeNode<ComponentConfig>
      extended by org.beanio.internal.config.ComponentConfig
          extended by org.beanio.internal.config.PropertyConfig
              extended by org.beanio.internal.config.GroupConfig
                  extended by org.beanio.internal.config.StreamConfig
All Implemented Interfaces:
Cloneable, Iterable<ComponentConfig>, SelectorConfig, Replicateable

public class StreamConfig
extends GroupConfig

A stream is the root (a.k.a top or parent) group of a stream mapping configuration. As such, it contains other attributes that apply to the entire stream.

By default, a stream can be used for both marshalling (write) and unmarshalling (read). Calling setMode(String) can restrict the use of the stream, but will relax some validations on the types of objects that can be read or written.

Since:
2.0
Author:
Kevin Seim

Field Summary
static String READ_ONLY_MODE
          Stream configuration supports reading only
static String READ_WRITE_MODE
          Stream configuration supports reading and writing
static String WRITE_ONLY_MODE
          Stream configuration supports writing only
 
Fields inherited from class org.beanio.internal.config.PropertyConfig
JSON_TYPE_ARRAY, JSON_TYPE_BOOLEAN, JSON_TYPE_NONE, JSON_TYPE_NUMBER, JSON_TYPE_OBJECT, JSON_TYPE_STRING
 
Fields inherited from class org.beanio.internal.config.ComponentConfig
CONSTANT, FIELD, GROUP, RECORD, SEGMENT, STREAM, WRAPPER
 
Constructor Summary
StreamConfig()
          Constructs a new StreamConfig.
 
Method Summary
 void addHandler(TypeHandlerConfig handler)
          Adds a custom type handler to this stream.
 char getComponentType()
          Returns the component type.
 String getFormat()
          Returns the format of this stream.
 List<TypeHandlerConfig> getHandlerList()
          Returns a list of customized type handlers configured for this stream.
 String getMode()
          Returns the allowed mode(s) of operation for this stream.
 BeanConfig getParserFactory()
          Returns the record parser factory configuration bean.
 String getResourceBundle()
          Returns the path name of the resource bundle containing customized error messages for this stream.
 boolean isIgnoreUnidentifiedRecords()
          Returns whether to ignore unidentified records.
 boolean isStrict()
          Returns whether BeanIO should calculate and enforce strict record ordering (based on the order records are declared in the mapping file) and record length (based on configured field occurrences).
 void setFormat(String format)
          Sets the format of this stream.
 void setIgnoreUnidentifiedRecords(boolean ignoreUnidentifiedRecords)
          Sets whether to ignore unidentified records.
 void setMode(String mode)
          Sets the allowed mode(s) of operation for this stream.
 void setParserFactory(BeanConfig parserFactory)
          Sets the record parser factory configuration bean.
 void setResourceBundle(String resourceBundle)
          Sets the path name of the resource bundle containing customized error messages for this stream.
 void setStrict(boolean strict)
          Sets whether BeanIO should calculate and enforce strict record ordering (based on the order records are declared in the mapping file) and record length (based on configured field occurrences).
 
Methods inherited from class org.beanio.internal.config.GroupConfig
getKey, getOrder, getTarget, isSupportedChild, setKey, setOrder, setTarget
 
Methods inherited from class org.beanio.internal.config.PropertyConfig
getCollection, getGetter, getJsonArrayIndex, getJsonName, getJsonType, getMaxOccurs, getMaxSize, getMinOccurs, getMinSize, getPosition, getSetter, getType, getUntil, getXmlType, isBound, isCollection, isIdentifier, isJsonArray, isLazy, isNillable, isRepeating, setBound, setCollection, setGetter, setIdentifier, setJsonArray, setJsonArrayIndex, setJsonName, setJsonType, setMaxOccurs, setMaxSize, setMinOccurs, setMinSize, setNillable, setPosition, setSetter, setType, setUntil, setXmlType
 
Methods inherited from class org.beanio.internal.config.ComponentConfig
getXmlName, getXmlNamespace, getXmlPrefix, isXmlNamespaceAware, setXmlName, setXmlNamespace, setXmlNamespaceAware, setXmlPrefix
 
Methods inherited from class org.beanio.internal.util.TreeNode
add, clone, find, getChildren, getFirst, getName, iterator, print, setName, size, sort, toParamString, toString, updateReferences
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.beanio.internal.config.SelectorConfig
getMaxOccurs, getMinOccurs, getName
 

Field Detail

READ_WRITE_MODE

public static final String READ_WRITE_MODE
Stream configuration supports reading and writing

See Also:
Constant Field Values

READ_ONLY_MODE

public static final String READ_ONLY_MODE
Stream configuration supports reading only

See Also:
Constant Field Values

WRITE_ONLY_MODE

public static final String WRITE_ONLY_MODE
Stream configuration supports writing only

See Also:
Constant Field Values
Constructor Detail

StreamConfig

public StreamConfig()
Constructs a new StreamConfig.

Method Detail

getComponentType

public char getComponentType()
Description copied from class: ComponentConfig
Returns the component type.

Specified by:
getComponentType in interface SelectorConfig
Overrides:
getComponentType in class GroupConfig
Returns:
one of ComponentConfig.GROUP, ComponentConfig.RECORD, ComponentConfig.SEGMENT, ComponentConfig.FIELD, ComponentConfig.CONSTANT or ComponentConfig.WRAPPER

getFormat

public String getFormat()
Returns the format of this stream.

Returns:
the stream format

setFormat

public void setFormat(String format)
Sets the format of this stream.

Parameters:
format - the stream format

getMode

public String getMode()
Returns the allowed mode(s) of operation for this stream.

Returns:
READ_WRITE_MODE if reading and writing from a stream is allowed,
READ_ONLY_MODE if only reading is allowed,
WRITE_ONLY_MODE if only writing is allowed,
or null if explicitly set

setMode

public void setMode(String mode)
Sets the allowed mode(s) of operation for this stream. If not set, or explicitly set to null, the stream configuration defaults to read/write. Some configuration validations are relaxed if set to read or write only.

Parameters:
mode - READ_WRITE_MODE if reading and writing from a stream is allowed,
READ_ONLY_MODE if only reading is allowed,
WRITE_ONLY_MODE if only writing is allowed

getResourceBundle

public String getResourceBundle()
Returns the path name of the resource bundle containing customized error messages for this stream.

Returns:
the resource bundle name

setResourceBundle

public void setResourceBundle(String resourceBundle)
Sets the path name of the resource bundle containing customized error messages for this stream.

Parameters:
resourceBundle - the resource bundle name

addHandler

public void addHandler(TypeHandlerConfig handler)
Adds a custom type handler to this stream.

Parameters:
handler - the type handler to add

getHandlerList

public List<TypeHandlerConfig> getHandlerList()
Returns a list of customized type handlers configured for this stream.

Returns:
the list of custom type handlers

getParserFactory

public BeanConfig getParserFactory()
Returns the record parser factory configuration bean.

Returns:
the record parser factory configuration bean.

setParserFactory

public void setParserFactory(BeanConfig parserFactory)
Sets the record parser factory configuration bean.

Parameters:
parserFactory - the record parser factory configuration bean

isStrict

public boolean isStrict()
Returns whether BeanIO should calculate and enforce strict record ordering (based on the order records are declared in the mapping file) and record length (based on configured field occurrences).

Returns:
true if strict, false otherwise

setStrict

public void setStrict(boolean strict)
Sets whether BeanIO should calculate and enforce strict record ordering (based on the order records are declared in the mapping file) and record length (based on configured field occurrences).

Parameters:
strict - true if strict, false otherwise

isIgnoreUnidentifiedRecords

public boolean isIgnoreUnidentifiedRecords()
Returns whether to ignore unidentified records. Defaults to false.

Returns:
true to ignore unidentified records, false otherwise
Since:
2.0.4

setIgnoreUnidentifiedRecords

public void setIgnoreUnidentifiedRecords(boolean ignoreUnidentifiedRecords)
Sets whether to ignore unidentified records. Defaults to false.

Parameters:
ignoreUnidentifiedRecords - true to ignore unidentified records, false otherwise
Since:
2.0.4

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim