Top Description Fields Constructors Methods
com.univocity.parsers.common.fields

public Class FieldSet<T>

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Known Direct Subclasses
com.univocity.parsers.common.fields.ExcludeFieldEnumSelector, com.univocity.parsers.common.fields.ExcludeFieldIndexSelector, com.univocity.parsers.common.fields.ExcludeFieldNameSelector, com.univocity.parsers.common.fields.FieldEnumSelector, com.univocity.parsers.common.fields.FieldIndexSelector, com.univocity.parsers.common.fields.FieldNameSelector
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).
Imports
com.univocity.parsers.common.*, java.util.*

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 - [email protected]
See Also
FieldNameSelector, FieldIndexSelector, CommonSettings

Field Summary

Modifier and TypeField and Description
private List<T>
private List<FieldSet<T>>

Constructor Summary

AccessConstructor and Description
public
FieldSet()

Creates am empty field set.

public
FieldSet(List<FieldSet<T>>
the field sets to be wrapped.
wrappedFieldSets
)

Creates a field set that wraps a collection of other field sets.

Method Summary

Modifier and TypeMethod and Description
public FieldSet<T>

Returns:

the set of currently selected fields
add
(T...
information that uniquely identifies each field
fields
)

Validates and adds multiple field references

public FieldSet<T>

Returns:

the set of currently selected fields
add
(Collection<T>
information that uniquely identifies each field
fields
)

Validates and adds multiple field references

private void
addElement(T
information that uniquely identifies a field
field
)

Validates and adds a reference to a field.

public FieldSet<T>
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public String

Returns:

a string that represents the current field selection
describe
()

Returns a string that represents the current field selection

public List<T>

Returns:

a copy of the fields in this set
get
()

Returns a copy of the fields in this set

public FieldSet<T>

Returns:

the set of currently selected fields
remove
(T...
information that uniquely identifies each field
fields
)

Removes multiple field references in the selection

public FieldSet<T>

Returns:

the set of currently selected fields
remove
(Collection<T>
information that uniquely identifies each field
fields
)

Removes multiple field references in the selection

public FieldSet<T>

Returns:

the set of currently selected fields
set
(T...
information that uniquely identifies each field
fields
)

Validates and sets multiple field references.

public FieldSet<T>

Returns:

the set of currently selected fields
set
(Collection<T>
information that uniquely identifies each field
fields
)

Validates and sets multiple field references.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

fieldsback to summary
private List<T> fields
wrappedFieldSetsback to summary
private List<FieldSet<T>> wrappedFieldSets

Constructor Detail

FieldSetback to summary
public FieldSet()

Creates am empty field set. For internal use only.

FieldSetback to summary
public FieldSet(List<FieldSet<T>> wrappedFieldSets)

Creates a field set that wraps a collection of other field sets. For internal use only.

Parameters
wrappedFieldSets:List<FieldSet<T>>

the field sets to be wrapped.

Method Detail

addback to summary
public FieldSet<T> add(T... fields)

Validates and adds multiple field references

Parameters
fields:T[]

information that uniquely identifies each field

Returns:FieldSet<T>

the set of currently selected fields

addback to summary
public FieldSet<T> add(Collection<T> fields)

Validates and adds multiple field references

Parameters
fields:Collection<T>

information that uniquely identifies each field

Returns:FieldSet<T>

the set of currently selected fields

addElementback to summary
private void addElement(T field)

Validates and adds a reference to a field.

Parameters
field:T

information that uniquely identifies a field

cloneback to summary
public FieldSet<T> clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:FieldSet<T>

a clone of this instance.

describeback to summary
public String describe()

Returns a string that represents the current field selection

Returns:String

a string that represents the current field selection

getback to summary
public List<T> get()

Returns a copy of the fields in this set

Returns:List<T>

a copy of the fields in this set

removeback to summary
public FieldSet<T> remove(T... fields)

Removes multiple field references in the selection

Parameters
fields:T[]

information that uniquely identifies each field

Returns:FieldSet<T>

the set of currently selected fields

removeback to summary
public FieldSet<T> remove(Collection<T> fields)

Removes multiple field references in the selection

Parameters
fields:Collection<T>

information that uniquely identifies each field

Returns:FieldSet<T>

the set of currently selected fields

setback to summary
public FieldSet<T> set(T... fields)

Validates and sets multiple field references. Any existing reference will be discarded.

Parameters
fields:T[]

information that uniquely identifies each field

Returns:FieldSet<T>

the set of currently selected fields

setback to summary
public FieldSet<T> set(Collection<T> fields)

Validates and sets multiple field references. Any existing reference will be discarded.

Parameters
fields:Collection<T>

information that uniquely identifies each field

Returns:FieldSet<T>

the set of currently selected fields

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override