use of net.morimekta.providence.reflect.parser.internal.ConstParser in project providence by morimekta.
the class ConstProvider method get.
@Override
public Object get() {
if (parsedValue == null) {
ConstParser parser = new ConstParser(registry, programContext, startLineNo, startLinePos);
@SuppressWarnings("unchecked") PDescriptor type = registry.getProvider(typeName, programContext, Collections.EMPTY_MAP).descriptor();
try (ByteArrayInputStream in = new ByteArrayInputStream(constantString.getBytes(StandardCharsets.UTF_8))) {
parsedValue = parser.parse(in, type);
} catch (IOException e) {
throw new UncheckedIOException(e.getMessage(), e);
}
}
return parsedValue;
}
Aggregations