Class PositionToBeanField<T>

java.lang.Object
com.opencsv.bean.AbstractFieldMapEntry<String,Integer,T>
com.opencsv.bean.PositionToBeanField<T>
Type Parameters:
T - Type of the bean being converted
All Implemented Interfaces:
ComplexFieldMapEntry<String,Integer,T>, Iterable<FieldMapByPositionEntry<T>>

public class PositionToBeanField<T> extends AbstractFieldMapEntry<String,Integer,T> implements Iterable<FieldMapByPositionEntry<T>>
Maps any column position matching a range definition to a BeanField.
  • Field Details

    • initializer

      private final String initializer
      This is the string used to initialize this set of ranges. This is necessary because the ranges may be attenuated later by attenuateRanges(int), rendering a reconstruction of the original initialization information impossible.
    • ranges

      private final List<org.apache.commons.lang3.Range<Integer>> ranges
      A list of ranges of column indices that should be mapped to the associated bean.
  • Constructor Details

  • Method Details

    • attenuateRanges

      public void attenuateRanges(int maxIndex)
      If there are ranges in the list of ranges encompassed by this mapping that stretch beyond the maximum index given, they are shortened to be no longer than the maximum index. Ranges that lie completely beyond the maximum index are shortened to a one-element range consisting of the range's lower boundary. No ranges are under any circumstances removed, as this might compromise checks for required fields.
      Parameters:
      maxIndex - The new maximum for ranges
    • contains

      public boolean contains(Integer key)
      Description copied from interface: ComplexFieldMapEntry
      Determines whether or not the given key is contained in this entry.
      Specified by:
      contains in interface ComplexFieldMapEntry<String,Integer,T>
      Parameters:
      key - The key to be located
      Returns:
      Whether key is represented by this entry
    • getInitializer

      public String getInitializer()
      Description copied from interface: ComplexFieldMapEntry
      Returns the information used to initialize this entry. This information is not guaranteed to be exactly the same as the original value, but is functionally equivalent.
      Specified by:
      getInitializer in interface ComplexFieldMapEntry<String,Integer,T>
      Returns:
      The original information used to initialize this mapping entry
    • iterator

      public Iterator<FieldMapByPositionEntry<T>> iterator()
      Specified by:
      iterator in interface Iterable<T>