public <T extends IBaseResource> T doParseResource(Class<T> theResourceType, JsonLikeStructure theJsonStructure) { JsonLikeObject object = theJsonStructure.getRootObject(); JsonLikeValue resourceTypeObj = object.get("resourceType"); if (resourceTypeObj == null || !resourceTypeObj.isString() || isBlank(resourceTypeObj.getAsString())) { throw new DataFormatException("Invalid JSON content detected, missing required element: 'resourceType'"); } String resourceType = resourceTypeObj.getAsString(); ParserState<? extends IBaseResource> state = ParserState.getPreResourceInstance(this, theResourceType, myContext, true, getErrorHandler()); state.enteringNewElement(null, resourceType); parseChildren(object, state); state.endingElement(); state.endingElement(); @SuppressWarnings("unchecked") T retVal = (T) state.getObject(); return retVal; }
parserState.endingElement();
theState.enteringNewElement(null, nextName); parseAlternates(nextValue, theState, alternateName, alternateName); theState.endingElement();
theState.enteringNewElement(null, nextName); parseAlternates(nextValue, theState, alternateName, alternateName); theState.endingElement(); theState.endingElement();
theState.endingElement(); theState.endingElement(); } else if (theJsonVal.isNull()) { theState.enteringNewElement(null, theName); parseAlternates(theAlternateVal, theState, theAlternateName, theAlternateName); theState.endingElement(); } else { theState.attributeValue("value", theJsonVal.getAsString()); parseAlternates(theAlternateVal, theState, theAlternateName, theAlternateName); theState.endingElement();
public <T extends IBaseResource> T doParseResource(Class<T> theResourceType, JsonLikeStructure theJsonStructure) { JsonLikeObject object = theJsonStructure.getRootObject(); JsonLikeValue resourceTypeObj = object.get("resourceType"); if (resourceTypeObj == null || !resourceTypeObj.isString() || isBlank(resourceTypeObj.getAsString())) { throw new DataFormatException("Invalid JSON content detected, missing required element: 'resourceType'"); } String resourceType = resourceTypeObj.getAsString(); ParserState<? extends IBaseResource> state = ParserState.getPreResourceInstance(this, theResourceType, myContext, true, getErrorHandler()); state.enteringNewElement(null, resourceType); parseChildren(object, state); state.endingElement(); state.endingElement(); @SuppressWarnings("unchecked") T retVal = (T) state.getObject(); return retVal; }
parserState.endingElement();
theState.enteringNewElement(null, nextName); parseAlternates(nextValue, theState, alternateName, alternateName); theState.endingElement();
theState.enteringNewElement(null, nextName); parseAlternates(nextValue, theState, alternateName, alternateName); theState.endingElement(); theState.endingElement();
theState.endingElement(); theState.endingElement(); } else if (theJsonVal.isNull()) { theState.enteringNewElement(null, theName); parseAlternates(theAlternateVal, theState, theAlternateName, theAlternateName); theState.endingElement(); } else { theState.attributeValue("value", theJsonVal.getAsString()); parseAlternates(theAlternateVal, theState, theAlternateName, theAlternateName); theState.endingElement();