Class BooleanParser

java.lang.Object
com.pervasive.datarush.encoding.text.BooleanParser
All Implemented Interfaces:
TokenParser

public class BooleanParser extends Object
A parser producing boolean token values from a user-specified mapping of text values.
  • Constructor Details

    • BooleanParser

      public BooleanParser(TruthValues mapping)
      Creates a parser using the specified mapping. Only empty strings are treated as null.
      Parameters:
      mapping - the mapping of strings to boolean values
    • BooleanParser

      public BooleanParser(TruthValues mapping, String nullIndicator)
      Creates a parser using the specified mapping. Empty strings and the specified text value are treated as null.
      Parameters:
      mapping - the mapping of strings to boolean values
      nullIndicator - the text value representing null
  • Method Details

    • setTarget

      public final void setTarget(ScalarSettable output)
      Description copied from interface: TokenParser
      Sets the buffer for holding parsed values. A reference to this container is held and accessed only when an formatting is requested.
      Specified by:
      setTarget in interface TokenParser
      Parameters:
      output - the value buffer in which to store parsed values
    • parse

      public final boolean parse(String text)
      Description copied from interface: TokenParser
      Parses the given text string into a token value. If the parse succeeds, the result is stored in the target buffer. If it fails, the contents of the target buffer are unchanged and information regarding failure will be saved that is accessible by calling the getParseError method.
      Specified by:
      parse in interface TokenParser
      Parameters:
      text - text string to convert. Callers should not assume it is safe to pass null.
      Returns:
      true if the parsing succeeded, false otherwise.
    • setParseError

      protected final void setParseError(String msg)
    • getParseError

      public final String getParseError()
      Description copied from interface: TokenParser
      When parse method returns false this method can be used to retrieve the specific error message detailing why the parsing failed. If the last parse was successful an empty string will be returned
      Specified by:
      getParseError in interface TokenParser
      Returns:
      a message detailing any parse errors that occurred during the last call to parse.