Class PositionToBeanField<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      PositionToBeanField​(java.lang.String rangeDefinition, int maxIndex, BeanField<T,​java.lang.Integer> field, java.util.Locale errorLocale)
      Initializes this mapping with a list of ranges and the associated BeanField.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      boolean contains​(java.lang.Integer key)
      Determines whether or not the given key is contained in this entry.
      java.lang.String getInitializer()
      Returns the information used to initialize this entry.
      java.util.Iterator<FieldMapByPositionEntry<T>> iterator()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • PositionToBeanField

        public PositionToBeanField​(java.lang.String rangeDefinition,
                                   int maxIndex,
                                   BeanField<T,​java.lang.Integer> field,
                                   java.util.Locale errorLocale)
        Initializes this mapping with a list of ranges and the associated BeanField.
        Parameters:
        rangeDefinition - A definition of ranges as documented in CsvBindAndJoinByPosition.position()
        maxIndex - The maximum index allowed for a range. Ranges will be adjusted as documented in attenuateRanges(int).
        field - The BeanField this mapping maps to
        errorLocale - The locale for error messages
        Throws:
        CsvBadConverterException - If rangeDefinition cannot be parsed
    • Method Detail

      • 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​(java.lang.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<java.lang.String,​java.lang.Integer,​T>
        Parameters:
        key - The key to be located
        Returns:
        Whether key is represented by this entry
      • getInitializer

        public java.lang.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<java.lang.String,​java.lang.Integer,​T>
        Returns:
        The original information used to initialize this mapping entry
      • iterator

        public java.util.Iterator<FieldMapByPositionEntry<T>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>