Package org.beanio.internal.config
Class StreamConfig
- java.lang.Object
-
- org.beanio.internal.util.TreeNode<ComponentConfig>
-
- org.beanio.internal.config.ComponentConfig
-
- org.beanio.internal.config.PropertyConfig
-
- org.beanio.internal.config.GroupConfig
-
- org.beanio.internal.config.StreamConfig
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
READ_ONLY_MODE
Stream configuration supports reading onlystatic java.lang.String
READ_WRITE_MODE
Stream configuration supports reading and writingstatic java.lang.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
-
-
Constructor Summary
Constructors Constructor Description StreamConfig()
Constructs a newStreamConfig
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHandler(TypeHandlerConfig handler)
Adds a custom type handler to this stream.char
getComponentType()
Returns the component type.java.lang.String
getFormat()
Returns the format of this stream.java.util.List<TypeHandlerConfig>
getHandlerList()
Returns a list of customized type handlers configured for this stream.java.lang.String
getMode()
Returns the allowed mode(s) of operation for this stream.BeanConfig<RecordParserFactory>
getParserFactory()
Returns the record parser factory configuration bean.java.lang.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(java.lang.String format)
Sets the format of this stream.void
setIgnoreUnidentifiedRecords(boolean ignoreUnidentifiedRecords)
Sets whether to ignore unidentified records.void
setMode(java.lang.String mode)
Sets the allowed mode(s) of operation for this stream.void
setParserFactory(BeanConfig<RecordParserFactory> parserFactory)
Sets the record parser factory configuration bean.void
setResourceBundle(java.lang.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, getLabel, getMaxOccurs, getMaxOccursRef, getMaxSize, getMinOccurs, getMinOccursRef, getMinSize, getOccursRef, getPosition, getSetter, getType, getUntil, getXmlType, isBound, isCollection, isIdentifier, isJsonArray, isLazy, isNillable, isRepeating, setBound, setCollection, setGetter, setIdentifier, setJsonArray, setJsonArrayIndex, setJsonName, setJsonType, setLabel, setLazy, setMaxOccurs, setMaxOccursRef, setMaxSize, setMinOccurs, setMinOccursRef, setMinSize, setNillable, setOccursRef, setPosition, setSetter, setType, setUntil, setXmlType
-
Methods inherited from class org.beanio.internal.config.ComponentConfig
getOrdinal, getXmlName, getXmlNamespace, getXmlPrefix, isXmlNamespaceAware, setOrdinal, setXmlName, setXmlNamespace, setXmlNamespaceAware, setXmlPrefix
-
Methods inherited from class org.beanio.internal.util.TreeNode
add, clone, find, getChildren, getFirst, getName, isDescendant, iterator, print, 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 java.lang.String READ_WRITE_MODE
Stream configuration supports reading and writing- See Also:
- Constant Field Values
-
READ_ONLY_MODE
public static final java.lang.String READ_ONLY_MODE
Stream configuration supports reading only- See Also:
- Constant Field Values
-
WRITE_ONLY_MODE
public static final java.lang.String WRITE_ONLY_MODE
Stream configuration supports writing only- See Also:
- Constant Field Values
-
-
Method Detail
-
getComponentType
public char getComponentType()
Description copied from class:ComponentConfig
Returns the component type.- Specified by:
getComponentType
in interfaceSelectorConfig
- Overrides:
getComponentType
in classGroupConfig
- Returns:
- one of
ComponentConfig.GROUP
,ComponentConfig.RECORD
,ComponentConfig.SEGMENT
,ComponentConfig.FIELD
,ComponentConfig.CONSTANT
orComponentConfig.WRAPPER
-
getFormat
public java.lang.String getFormat()
Returns the format of this stream.- Returns:
- the stream format
-
setFormat
public void setFormat(java.lang.String format)
Sets the format of this stream.- Parameters:
format
- the stream format
-
getMode
public java.lang.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, ornull
if explicitly set
-
setMode
public void setMode(java.lang.String mode)
Sets the allowed mode(s) of operation for this stream. If not set, or explicitly set tonull
, 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 java.lang.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(java.lang.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 java.util.List<TypeHandlerConfig> getHandlerList()
Returns a list of customized type handlers configured for this stream.- Returns:
- the list of custom type handlers
-
getParserFactory
public BeanConfig<RecordParserFactory> getParserFactory()
Returns the record parser factory configuration bean.- Returns:
- the record parser factory configuration bean.
-
setParserFactory
public void setParserFactory(BeanConfig<RecordParserFactory> 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
-
-