uk.ac.ed.epcc.safe.accounting.parsers.value

Class LongParser

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static LongParser PARSER
      Useful static instance of this object to be used when one doesn't want to generate lots of parsers when one will suffice
    • Constructor Summary

      Constructors 
      Constructor and Description
      LongParser() 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.String format(java.lang.Long value)
      Format a value as a string.
      java.lang.Class<java.lang.Long> getType()
      Returns the Class of object this ValueParser can handle.
      java.lang.Long parse(java.lang.String valueString)
      Parses the specified string and constructs the appropriate object out of it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PARSER

        public static final LongParser PARSER
        Useful static instance of this object to be used when one doesn't want to generate lots of parsers when one will suffice
    • Constructor Detail

      • LongParser

        public LongParser()
    • Method Detail

      • getType

        public java.lang.Class<java.lang.Long> getType()
        Description copied from interface: ValueParser
        Returns the Class of object this ValueParser can handle. The ValueParser.parse(String) method must return objects that are assignable to this type. The #format(T) method can format any object assignable to this type. The returned class will be the exact Class (i.e. not a subclass) of this ValueParser's type
        Specified by:
        getType in interface ValueFormatter<java.lang.Long>
        Specified by:
        getType in interface ValueParser<java.lang.Long>
        Returns:
        The Type of this ValueParser
      • parse

        public java.lang.Long parse(java.lang.String valueString)
                             throws java.lang.IllegalArgumentException,
                                    java.lang.NullPointerException
        Description copied from interface: ValueParser
        Parses the specified string and constructs the appropriate object out of it.
        Specified by:
        parse in interface ValueParser<java.lang.Long>
        Throws:
        java.lang.IllegalArgumentException
        java.lang.NullPointerException
        Parameters:
        valueString - The string to parse
        Returns:
        The object representation of valueString
      • format

        public java.lang.String format(java.lang.Long value)
        Description copied from interface: ValueParser
        Format a value as a string. The resulting string must be in a form that can be parsed by this ValueParser
        Specified by:
        format in interface ValueFormatter<java.lang.Long>
        Specified by:
        format in interface ValueParser<java.lang.Long>
        Parameters:
        value - The object to format
        Returns:
        String