Class FieldSet<T>
- java.lang.Object
-
- com.univocity.parsers.common.fields.FieldSet<T>
-
- Type Parameters:
T
- the type of the reference information used to uniquely identify a field (e.g. references to field indexes would use Integer, while references to field names would use String).
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
ExcludeFieldEnumSelector
,ExcludeFieldIndexSelector
,ExcludeFieldNameSelector
,FieldEnumSelector
,FieldIndexSelector
,FieldNameSelector
public class FieldSet<T> extends java.lang.Object implements java.lang.Cloneable
A set of selected fields.Used by
CommonSettings
to select fields for reading/writingAlso used by
com.univocity.parsers.common.processor.ConversionProcessor
to select fields that have to be converted.- See Also:
FieldNameSelector
,FieldIndexSelector
,CommonSettings
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<T>
fields
private java.util.List<FieldSet<T>>
wrappedFieldSets
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldSet<T>
add(java.util.Collection<T> fields)
Validates and adds multiple field referencesFieldSet<T>
add(T... fields)
Validates and adds multiple field referencesprivate void
addElement(T field)
Validates and adds a reference to a field.FieldSet<T>
clone()
java.lang.String
describe()
Returns a string that represents the current field selectionjava.util.List<T>
get()
Returns a copy of the fields in this setFieldSet<T>
remove(java.util.Collection<T> fields)
Removes multiple field references in the selectionFieldSet<T>
remove(T... fields)
Removes multiple field references in the selectionFieldSet<T>
set(java.util.Collection<T> fields)
Validates and sets multiple field references.FieldSet<T>
set(T... fields)
Validates and sets multiple field references.java.lang.String
toString()
-
-
-
Method Detail
-
get
public java.util.List<T> get()
Returns a copy of the fields in this set- Returns:
- a copy of the fields in this set
-
set
public FieldSet<T> set(T... fields)
Validates and sets multiple field references. Any existing reference will be discarded.- Parameters:
fields
- information that uniquely identifies each field- Returns:
- the set of currently selected fields
-
add
public FieldSet<T> add(T... fields)
Validates and adds multiple field references- Parameters:
fields
- information that uniquely identifies each field- Returns:
- the set of currently selected fields
-
addElement
private void addElement(T field)
Validates and adds a reference to a field.- Parameters:
field
- information that uniquely identifies a field
-
set
public FieldSet<T> set(java.util.Collection<T> fields)
Validates and sets multiple field references. Any existing reference will be discarded.- Parameters:
fields
- information that uniquely identifies each field- Returns:
- the set of currently selected fields
-
add
public FieldSet<T> add(java.util.Collection<T> fields)
Validates and adds multiple field references- Parameters:
fields
- information that uniquely identifies each field- Returns:
- the set of currently selected fields
-
remove
public FieldSet<T> remove(T... fields)
Removes multiple field references in the selection- Parameters:
fields
- information that uniquely identifies each field- Returns:
- the set of currently selected fields
-
remove
public FieldSet<T> remove(java.util.Collection<T> fields)
Removes multiple field references in the selection- Parameters:
fields
- information that uniquely identifies each field- Returns:
- the set of currently selected fields
-
describe
public java.lang.String describe()
Returns a string that represents the current field selection- Returns:
- a string that represents the current field selection
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-