public static TextDetectionJsonUnmarshaller getInstance() { if (instance == null) instance = new TextDetectionJsonUnmarshaller(); return instance; } }
public DetectTextResult unmarshall(JsonUnmarshallerContext context) throws Exception { DetectTextResult detectTextResult = new DetectTextResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return detectTextResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("TextDetections", targetDepth)) { context.nextToken(); detectTextResult.setTextDetections(new ListUnmarshaller<TextDetection>(TextDetectionJsonUnmarshaller.getInstance()).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return detectTextResult; }
public DetectTextResult unmarshall(JsonUnmarshallerContext context) throws Exception { DetectTextResult detectTextResult = new DetectTextResult(); AwsJsonReader reader = context.getReader(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("TextDetections")) { detectTextResult.setTextDetections(new ListUnmarshaller<TextDetection>( TextDetectionJsonUnmarshaller.getInstance() ) .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return detectTextResult; }
public static TextDetectionJsonUnmarshaller getInstance() { if (instance == null) instance = new TextDetectionJsonUnmarshaller(); return instance; } }