Class ConstParser
- java.lang.Object
-
- net.morimekta.providence.reflect.parser.internal.ConstParser
-
public class ConstParser extends java.lang.ObjectParsing 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.Objectparse(java.io.InputStream inputStream, net.morimekta.providence.descriptor.PDescriptor type)java.lang.Objectparse(java.io.Reader reader, net.morimekta.providence.descriptor.PDescriptor type)
-
-
-
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.
-
-