Enum Class FieldModifiers

java.lang.Object
java.lang.Enum<FieldModifiers>
de.siegmar.fastcsv.reader.FieldModifiers
All Implemented Interfaces:
FieldModifier, Serializable, Comparable<FieldModifiers>, Constable

public enum FieldModifiers extends Enum<FieldModifiers> implements FieldModifier

Provides some common FieldModifier implementations.

Example usage:

FieldModifier modifier = FieldModifiers.TRIM
    .andThen(FieldModifier.modify(field -> field.toUpperCase(Locale.ENGLISH)));
CsvRecordHandler handler = CsvRecordHandler.of(c -> c.fieldModifier(modifier));
List<CsvRecord> records = CsvReader.builder()
    .build(handler, "  foo   ,   bar")
    .stream()
    .toList();

// fields would be: "FOO" and "BAR"
  • Enum Constant Details

    • NOP

      public static final FieldModifiers NOP
      Modifier that does not modify anything.
    • TRIM

      public static final FieldModifiers TRIM
      Modifier that modifies the field value with String.trim(). Comments are not modified.
    • STRIP

      public static final FieldModifiers STRIP
      Modifier that modifies the field value with String.strip(). Comments are not modified.
  • Method Details

    • values

      public static FieldModifiers[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static FieldModifiers valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null