}
public AstNode parse(String className, Reader reader) throws IOException {
ObjectMapper mapper = new ObjectMapper();
JsonFactory factory = mapper.getFactory();
JsonParser parser = factory.createJsonParser(reader);
String xName = className + System.currentTimeMillis();
stack.add(new AstNode(xName, null, false)); //artificial root element - must stay on the top of the Stack
doField(className, parser);
if (!xName.equals(stack.peek().getName())) {
throw new IllegalStateException("Artificial element " + xName + " not found on the top of the stack");