/** * <p> * An array of text that was detected in the input image. * </p> * * @param textDetections * An array of text that was detected in the input image. * @return Returns a reference to this object so that method calls can be chained together. */ public DetectTextResult withTextDetections(java.util.Collection<TextDetection> textDetections) { setTextDetections(textDetections); return this; }
/** * <p> * An array of text that was detected in the input image. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setTextDetections(java.util.Collection)} or {@link #withTextDetections(java.util.Collection)} if you want * to override the existing values. * </p> * * @param textDetections * An array of text that was detected in the input image. * @return Returns a reference to this object so that method calls can be chained together. */ public DetectTextResult withTextDetections(TextDetection... textDetections) { if (this.textDetections == null) { setTextDetections(new java.util.ArrayList<TextDetection>(textDetections.length)); } for (TextDetection ele : textDetections) { this.textDetections.add(ele); } return this; }
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; }
/** * <p> * An array of text that was detected in the input image. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param textDetections <p> * An array of text that was detected in the input image. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public DetectTextResult withTextDetections(java.util.Collection<TextDetection> textDetections) { setTextDetections(textDetections); return this; }
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; }