Class ParseEnum

    • Constructor Summary

      Constructors 
      Constructor Description
      ParseEnum​(java.lang.Class<T> enumClass)
      Constructs a new ParseEnum processor, which converts a String to a Enum.
      ParseEnum​(java.lang.Class<T> enumClass, boolean ignoreCase)
      Constructs a new ParseEnum processor, which converts a String to a Enum, ignoring the case of the input (or not) depending on the supplied flag.
      ParseEnum​(java.lang.Class<T> enumClass, boolean ignoreCase, CellProcessor next)
      Constructs a new ParseEnum processor, which converts a String to a Enum, ignoring the case of the input (or not) depending on the supplied flag, then calls the next processor in the chain.
      ParseEnum​(java.lang.Class<T> enumClass, CellProcessor next)
      Constructs a new ParseEnum processor, which converts a String to a Enum then calls the next processor in the chain.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object execute​(java.lang.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 java.lang.Object

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

      • ParseEnum

        public ParseEnum​(java.lang.Class<T> enumClass)
        Constructs a new ParseEnum processor, which converts a String to a Enum.
        Type Parameters:
        T - the Enum type
        Parameters:
        enumClass - the enum class to convert to
        Throws:
        java.lang.NullPointerException - if enumClass is null
      • ParseEnum

        public ParseEnum​(java.lang.Class<T> enumClass,
                         boolean ignoreCase)
        Constructs a new ParseEnum processor, which converts a String to a Enum, ignoring the case of the input (or not) depending on the supplied flag.
        Type Parameters:
        T - the Enum type
        Parameters:
        enumClass - the enum class to convert to
        ignoreCase - whether to ignore the case of the input
        Throws:
        java.lang.NullPointerException - if enumClass is null
      • ParseEnum

        public ParseEnum​(java.lang.Class<T> enumClass,
                         CellProcessor next)
        Constructs a new ParseEnum processor, which converts a String to a Enum then calls the next processor in the chain.
        Type Parameters:
        T - the Enum type
        Parameters:
        enumClass - the enum class to convert to
        next - the next processor in the chain
        Throws:
        java.lang.NullPointerException - if enumClass or next is null
      • ParseEnum

        public ParseEnum​(java.lang.Class<T> enumClass,
                         boolean ignoreCase,
                         CellProcessor next)
        Constructs a new ParseEnum processor, which converts a String to a Enum, ignoring the case of the input (or not) depending on the supplied flag, then calls the next processor in the chain.
        Type Parameters:
        T - the Enum type
        Parameters:
        enumClass - the enum class to convert to
        ignoreCase - whether to ignore the case of the input
        next - the next processor in the chain
        Throws:
        java.lang.NullPointerException - if enumClass or next is null
    • Method Detail

      • execute

        public java.lang.Object execute​(java.lang.Object value,
                                        CsvContext context)
        This method is invoked by the framework when the processor needs to process data or check constraints.
        Specified by:
        execute in interface CellProcessor
        Parameters:
        value - the value to be processed
        context - the CSV context
        Returns:
        the result of cell processor execution
        Throws:
        SuperCsvCellProcessorException - if value is null or can't be parsed as an Enum