|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.parsers.common.EntityParserSettings<S,L,C>
S - an internal configuration object that extends from CommonParserSettings, and is used to
manage configuration of elements shared with univocity-parsersL - the EntityList implementation supported by an EntityParserInterface.C - the Context implementation which provides information about the entity parser and its execution.public abstract class EntityParserSettings<S extends com.univocity.parsers.common.CommonParserSettings,L extends EntityList,C extends com.univocity.parsers.common.Context>
Base configuration class of a parser that produces records for multiple entities. The settings available in
an EntityParserSettings configure the parsing process and provide default configuration options
that individual implementations of EntitySettings can override.
Entities are managed from an EntityList implementation.
| Field Summary | |
|---|---|
protected Set<String> |
entitiesToRead
|
protected Set<String> |
entitiesToSkip
|
protected S |
globalSettings
|
| Constructor Summary | |
|---|---|
EntityParserSettings()
Creates a new configuration object for an implementation of EntityParserInterface, which will process
an input to produce records for entities defined by an EntityList |
|
| Method Summary | |
|---|---|
void |
addEntitiesToRead(Collection<String> entitiesToRead)
Adds one or more entities to the existing selection of entities to read. |
void |
addEntitiesToRead(String... entitiesToRead)
Adds one or more entities to the existing selection of entities to read. |
void |
addEntitiesToSkip(Collection<String> entitiesToSkip)
Adds one or more entities to the existing selection of of entities to skip. |
void |
addEntitiesToSkip(String... entitiesToSkip)
Adds one or more entities to the list of entities to skip. |
protected EntityParserSettings<S,L,C> |
clone()
|
protected static com.univocity.parsers.common.CommonParserSettings |
createEmptyGlobalSettings()
Utility method to create new, empty instances of CommonParserSettings. |
protected abstract S |
createGlobalSettings()
Forces concrete implementations of this class to produce an instance of CommonParserSettings, which
will be used to configure elements shared with univocity-parsers |
Set<String> |
getEntitiesToRead()
Returns the unmodifiable set of entities to read. |
Set<String> |
getEntitiesToSkip()
Returns an unmodifiable set of names of entities to be skipped. |
int |
getErrorContentLength()
Configures the parser to limit the length of displayed contents being processed in the exception message when an error occurs |
String |
getNullValue()
Returns the String representation of a null value (defaults to null) |
com.univocity.parsers.common.ProcessorErrorHandler<C> |
getProcessorErrorHandler()
Returns the custom error handler to be used to capture and handle errors that might happen while processing records with a Processor
(i.e. |
boolean |
getTrimLeadingWhitespaces()
Returns whether or not leading whitespaces from values being read should be trimmed (defaults to true) |
boolean |
getTrimTrailingWhitespaces()
Returns whether or not trailing whitespaces from values being read should be trimmed (defaults to true) |
void |
setEntitiesToRead(Collection<String> entitiesToRead)
Sets one or more entities as the list of entities to read. |
void |
setEntitiesToRead(String... entitiesToRead)
Sets one or more entities as the list of entities to read. |
void |
setEntitiesToSkip(Collection<String> entitiesToSkip)
Sets one or more entities as the list of entities to skip. |
void |
setEntitiesToSkip(String... entitiesToSkip)
Sets one or more entities as the list of entities to skip. |
void |
setErrorContentLength(int errorContentLength)
Configures the parser to limit the length of displayed contents being processed in the exception message when an error occurs |
void |
setNullValue(String nullValue)
Defines the String representation of a null value (defaults to null) |
void |
setProcessorErrorHandler(com.univocity.parsers.common.ProcessorErrorHandler<C> processorErrorHandler)
Defines a custom error handler to be used to capture and handle errors that might happen while processing records with a Processor
(i.e. |
void |
setTrimLeadingWhitespaces(boolean trimTrailingWhitespaces)
Defines whether or not trailing whitespaces from values being read should be trimmed (defaults to true) |
void |
setTrimTrailingWhitespaces(boolean trimTrailingWhitespaces)
Defines whether or not trailing whitespaces from values being read should be trimmed (defaults to true) |
boolean |
shouldRead(String entityName)
Tests whether a given entity should be processed (i.e. |
boolean |
shouldSkip(String entityName)
Tests whether a given entity should be skipped, so the parser can ignore/not process its records. |
void |
trimValues(boolean trim)
Configures the parser to trim/keep leading and trailing whitespaces around values This has the same effect as invoking both setTrimLeadingWhitespaces(boolean)
and setTrimTrailingWhitespaces(boolean) with the same value. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Set<String> entitiesToRead
protected Set<String> entitiesToSkip
protected S extends com.univocity.parsers.common.CommonParserSettings globalSettings
| Constructor Detail |
|---|
public EntityParserSettings()
EntityParserInterface, which will process
an input to produce records for entities defined by an EntityList
| Method Detail |
|---|
protected static final com.univocity.parsers.common.CommonParserSettings createEmptyGlobalSettings()
CommonParserSettings. For internal use only.
CommonParserSettings class.protected abstract S createGlobalSettings()
CommonParserSettings, which
will be used to configure elements shared with univocity-parsers
CommonParserSettingspublic final void addEntitiesToRead(Collection<String> entitiesToRead)
entitiesToRead - names of the entities to be read.public final void addEntitiesToRead(String... entitiesToRead)
entitiesToRead - names of the entities to be read.public final void addEntitiesToSkip(Collection<String> entitiesToSkip)
entitiesToSkip - names of the entities to be skipped.public final Set<String> getEntitiesToRead()
public final void setEntitiesToRead(Collection<String> entitiesToRead)
entitiesToRead - names of the entities to be read.public final void setEntitiesToRead(String... entitiesToRead)
entitiesToRead - names of the entities to be read.public final Set<String> getEntitiesToSkip()
public final void setEntitiesToSkip(String... entitiesToSkip)
entitiesToSkip - names of the entities to be skipped.public final void addEntitiesToSkip(String... entitiesToSkip)
entitiesToSkip - names of the entities to be skipped.public final void setEntitiesToSkip(Collection<String> entitiesToSkip)
entitiesToSkip - names of the entities to be skipped.public final boolean shouldSkip(String entityName)
entitiesToSkip or
not in the set of entitiesToRead, if it is not empty
entityName - name of the entity
true if the entity should be skipped, otherwise falsepublic final boolean shouldRead(String entityName)
entitiesToSkip or
are in the set of entitiesToRead, if it is not empty
entityName - name of entity
true if the entity should be read, otherwise falsepublic final com.univocity.parsers.common.ProcessorErrorHandler<C> getProcessorErrorHandler()
Processor
(i.e. non-fatal DataProcessingExceptions).
The parsing process won't stop (unless the error handler rethrows the DataProcessingException
or manually stops the process).
DataProcessingException.public final void setProcessorErrorHandler(com.univocity.parsers.common.ProcessorErrorHandler<C> processorErrorHandler)
Processor
(i.e. non-fatal DataProcessingExceptions).
The parsing process won't stop (unless the error handler rethrows the DataProcessingException
or manually stops the process).
processorErrorHandler - the callback error handler with custom code to manage occurrences of DataProcessingException.public final boolean getTrimTrailingWhitespaces()
true)
true if trailing whitespaces from values being read should be trimmed, false otherwisepublic final void setTrimTrailingWhitespaces(boolean trimTrailingWhitespaces)
true)
trimTrailingWhitespaces - flag indicating whether to remove trailing whitespaces from values being readpublic final boolean getTrimLeadingWhitespaces()
true)
true if leading whitespaces from values being read should be trimmed, false otherwisepublic final void setTrimLeadingWhitespaces(boolean trimTrailingWhitespaces)
true)
trimTrailingWhitespaces - flag indicating whether to remove trailing whitespaces from values being readpublic final void trimValues(boolean trim)
setTrimLeadingWhitespaces(boolean)
and setTrimTrailingWhitespaces(boolean) with the same value.
trim - a flag indicating whether whitespaces should be removed around values parsed.public final int getErrorContentLength()
If set to 0, then no exceptions will include the content being manipulated in their attributes,
and the "<omitted>" string will appear in error messages as the parsed content.
defaults to -1 (no limit)
public final void setErrorContentLength(int errorContentLength)
If set to 0, then no exceptions will include the content being manipulated in their attributes,
and the "<omitted>" string will appear in error messages as the parsed content.
defaults to -1 (no limit)
errorContentLength - the maximum length of contents displayed in exception messages in case of errors while parsing.public final String getNullValue()
String representation of a null value (defaults to null)
When reading, if the parser does not read any character from the input for a particular value, the nullValue
is used instead of an empty String
public final void setNullValue(String nullValue)
String representation of a null value (defaults to null)
When reading, if the parser does not read any character from the input for a particular value, the nullValue
is used instead of an empty String
nullValue - the String representation of a null valueprotected EntityParserSettings<S,L,C> clone()
clone in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||