Documentation of 'org.supercsv.cellprocessor.ParseBool' Java class
ParseBool
org.supercsv.cellprocessor

Class ParseBool

  • All Implemented Interfaces:
    CellProcessor, StringCellProcessor


    public class ParseBool
    extends CellProcessorAdaptor
    implements StringCellProcessor
    Converts a String to a Boolean.

    The default values for true are: "true", "1", "y", "t"

    The default values for false are: "false", "0", "n", "f"

    The input is converted to lowercase before comparison against the true/false values (to handle all variations of case in the input), so if you supply your own true/false values then ensure they are lowercase.

    Since:
    1.0
    • Constructor Summary

      Constructors 
      Constructor and Description
      ParseBool()
      Constructs a new ParseBool processor, which converts a String to a Boolean using the default values.
      ParseBool(BoolCellProcessor next)
      Constructs a new ParseBool processor, which converts a String to a Boolean using the default values, then calls the next processor in the chain.
      ParseBool(java.lang.String[] trueValues, java.lang.String[] falseValues)
      Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false values.
      ParseBool(java.lang.String[] trueValues, java.lang.String[] falseValues, BoolCellProcessor next)
      Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false values, then calls the next processor in the chain.
      ParseBool(java.lang.String trueValue, java.lang.String falseValue)
      Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false values.
      ParseBool(java.lang.String trueValue, java.lang.String falseValue, BoolCellProcessor next)
      Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false values, then calls the next processor in the chain.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and 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

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

      • ParseBool

        public ParseBool()
        Constructs a new ParseBool processor, which converts a String to a Boolean using the default values.
      • ParseBool

        public ParseBool(BoolCellProcessor next)
        Constructs a new ParseBool processor, which converts a String to a Boolean using the default values, then calls the next processor in the chain.
        Parameters:
        next - the next processor in the chain
        Throws:
        java.lang.NullPointerException - if next is null
      • ParseBool

        public ParseBool(java.lang.String trueValue,
                         java.lang.String falseValue)
        Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false values.
        Parameters:
        trueValue - the String which represents true
        falseValue - the String which represents false
        Throws:
        java.lang.NullPointerException - if trueValue or falseValue is null
      • ParseBool

        public ParseBool(java.lang.String[] trueValues,
                         java.lang.String[] falseValues)
        Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false values.
        Parameters:
        trueValues - the array of Strings which represent true
        falseValues - the array of Strings which represent false
        Throws:
        java.lang.IllegalArgumentException - if trueValues or falseValues is empty
        java.lang.NullPointerException - if trueValues or falseValues is null
      • ParseBool

        public ParseBool(java.lang.String trueValue,
                         java.lang.String falseValue,
                         BoolCellProcessor next)
        Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false values, then calls the next processor in the chain.
        Parameters:
        trueValue - the String which represents true
        falseValue - the String which represents false
        next - the next processor in the chain
        Throws:
        java.lang.NullPointerException - if trueValue, falseValue or next is null
      • ParseBool

        public ParseBool(java.lang.String[] trueValues,
                         java.lang.String[] falseValues,
                         BoolCellProcessor next)
        Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false values, then calls the next processor in the chain.
        Parameters:
        trueValues - the array of Strings which represent true
        falseValues - the array of Strings which represent false
        next - the next processor in the chain
        Throws:
        java.lang.IllegalArgumentException - if trueValues or falseValues is empty
        java.lang.NullPointerException - if trueValues, falseValues, 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
        Throws:
        SuperCsvCellProcessorException - if value is null, not a String, or can't be parsed to a Boolean

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.