Class ConstParser


  • public class ConstParser
    extends java.lang.Object
    Parsing thrift constants from string to actual value. This uses a JSON like format with some allowed special references.
    • Enums can be 'EnumName.VALUE' or 'program.EnumName.VALUE', no quotes.
    • Enums values can be used as integer constants.
    • String literals can be single-quoted.
    • Lists and map entries have optional separator ',', ';' and none.
    • Last element of list or map may have an ending list separator.
    • Map keys may be non-string values like numbers or enum value reference.
    • Constructor Summary

      Constructors 
      Constructor Description
      ConstParser​(net.morimekta.providence.util.TypeRegistry registry, java.lang.String programContext, int startLineNo, int startLinePos)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object parse​(java.io.InputStream inputStream, net.morimekta.providence.descriptor.PDescriptor type)  
      java.lang.Object parse​(java.io.Reader reader, net.morimekta.providence.descriptor.PDescriptor type)  
      • Methods inherited from class java.lang.Object

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

      • ConstParser

        public ConstParser​(net.morimekta.providence.util.TypeRegistry registry,
                           java.lang.String programContext,
                           int startLineNo,
                           int startLinePos)
    • Method Detail

      • parse

        public java.lang.Object parse​(java.io.InputStream inputStream,
                                      net.morimekta.providence.descriptor.PDescriptor type)
                               throws ParseException
        Parameters:
        inputStream - Input stream to parse.
        type - The constant type descriptor.
        Returns:
        The parsed constant value.
        Throws:
        ParseException - If not able to parse the constant.
      • parse

        public java.lang.Object parse​(java.io.Reader reader,
                                      net.morimekta.providence.descriptor.PDescriptor type)
                               throws ParseException
        Parameters:
        reader - Input stream to parse.
        type - The constant type descriptor.
        Returns:
        The parsed constant value.
        Throws:
        ParseException - If not able to parse the constant.