Class Strlen

java.lang.Object
org.supercsv.cellprocessor.CellProcessorAdaptor
org.supercsv.cellprocessor.constraint.Strlen
All Implemented Interfaces:
CellProcessor, StringCellProcessor

public class Strlen extends CellProcessorAdaptor implements StringCellProcessor
This processor ensures that the input String has a length equal to any of the supplied lengths. The length constraints must all be > 0 or an exception is thrown. Lookup time is O(1).
Author:
Kasper B. Graversen, Dominique De Vito, James Bassett
  • Field Summary

    Fields inherited from class CellProcessorAdaptor

    next
  • Constructor Summary

    Constructors
    Constructor
    Description
    Strlen(int... requiredLengths)
    Constructs a new Strlen processor, which ensures that the input String has a length equal to any of the supplied lengths.
    Strlen(int[] requiredLengths, CellProcessor next)
    Constructs a new Strlen processor, which ensures that the input String has a length equal to any of the supplied lengths, then calls the next processor in the chain.
    Strlen(int requiredLength, CellProcessor next)
    Constructs a new Strlen processor, which ensures that the input String has a length equal to the supplied length, then calls the next processor in the chain.
  • Method Summary

    Modifier and Type
    Method
    Description
    execute(Object value, CsvContext context)
    This method is invoked by the framework when the processor needs to process data or check constraints.

    Methods inherited from class CellProcessorAdaptor

    toString, validateInputNotNull

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Strlen

      public Strlen(int... requiredLengths)
      Constructs a new Strlen processor, which ensures that the input String has a length equal to any of the supplied lengths.
      Parameters:
      requiredLengths - one or more required lengths
      Throws:
      NullPointerException - if requiredLengths is null
      IllegalArgumentException - if requiredLengths is empty or contains a negative length
    • Strlen

      public Strlen(int requiredLength, CellProcessor next)
      Constructs a new Strlen processor, which ensures that the input String has a length equal to the supplied length, then calls the next processor in the chain.
      Parameters:
      requiredLength - the required length
      next - the next processor in the chain
      Throws:
      NullPointerException - if next is null
      IllegalArgumentException - if requiredLength is negative
    • Strlen

      public Strlen(int[] requiredLengths, CellProcessor next)
      Constructs a new Strlen processor, which ensures that the input String has a length equal to any of the supplied lengths, then calls the next processor in the chain.
      Parameters:
      requiredLengths - one or more required lengths
      next - the next processor in the chain
      Throws:
      NullPointerException - if requiredLengths or next is null
      IllegalArgumentException - if requiredLengths is empty or contains a negative length
  • Method Details