com.univocity.parsers.common.fields
Class FieldSet<T>

java.lang.Object
  extended by 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).
Direct Known Subclasses:
ExcludeFieldEnumSelector, ExcludeFieldIndexSelector, ExcludeFieldNameSelector, FieldEnumSelector, FieldIndexSelector, FieldNameSelector

public class FieldSet<T>
extends Object

A set of selected fields.

Used by CommonSettings to select fields for reading/writing

Also used by com.univocity.parsers.common.processor.ConversionProcessor to select fields that have to be converted.

Author:
uniVocity Software Pty Ltd - parsers@univocity.com
See Also:
FieldNameSelector, FieldIndexSelector, CommonSettings

Constructor Summary
FieldSet()
          Creates am empty field set.
FieldSet(List<FieldSet<T>> wrappedFieldSets)
          Creates a field set that wraps a collection of other field sets.
 
Method Summary
 FieldSet<T> add(Collection<T> fields)
          Validates and adds multiple field references
 FieldSet<T> add(T... fields)
          Validates and adds multiple field references
 String describe()
          Returns a string that represents the current field selection
 List<T> get()
          Returns a copy of the fields in this set
 FieldSet<T> remove(Collection<T> fields)
          Removes multiple field references in the selection
 FieldSet<T> remove(T... fields)
          Removes multiple field references in the selection
 FieldSet<T> set(Collection<T> fields)
          Validates and sets multiple field references.
 FieldSet<T> set(T... fields)
          Validates and sets multiple field references.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldSet

public FieldSet()
Creates am empty field set. For internal use only.


FieldSet

public FieldSet(List<FieldSet<T>> wrappedFieldSets)
Creates a field set that wraps a collection of other field sets. For internal use only.

Parameters:
wrappedFieldSets - the field sets to be wrapped.
Method Detail

get

public 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

set

public FieldSet<T> set(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(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(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 String describe()
Returns a string that represents the current field selection

Returns:
a string that represents the current field selection

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2017 uniVocity Software Pty Ltd. All rights reserved.