Class RegexToBeanField<T>

java.lang.Object
com.opencsv.bean.AbstractFieldMapEntry<String,String,T>
com.opencsv.bean.RegexToBeanField<T>
Type Parameters:
T - The type of the bean being converted
All Implemented Interfaces:
ComplexFieldMapEntry<String,String,T>

public class RegexToBeanField<T> extends AbstractFieldMapEntry<String,String,T>
Maps any header name matching a regular expression to a BeanField.
Since:
4.2
  • Field Details

    • regex

      private final Pattern regex
      The compiled regular expression used to match header names.
  • Constructor Details

    • RegexToBeanField

      public RegexToBeanField(String pattern, BeanField<T,String> field, Locale errorLocale)
      Initializes this mapping with the regular expression used to map header names and the BeanField they should be mapped to.
      Parameters:
      pattern - A valid regular expression against which potential header names are matched
      field - The BeanField this mapping maps to
      errorLocale - The locale for error messages
  • Method Details

    • contains

      public boolean contains(String key)
      Description copied from interface: ComplexFieldMapEntry
      Determines whether or not the given key is contained in this entry.
      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.
      Returns:
      The original information used to initialize this mapping entry