@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getBoundingBox() == null) ? 0 : getBoundingBox().hashCode()); hashCode = prime * hashCode + ((getPolygon() == null) ? 0 : getPolygon().hashCode()); return hashCode; }
/** * <p> * An axis-aligned coarse representation of the detected text's location on the image. * </p> * * @param boundingBox * An axis-aligned coarse representation of the detected text's location on the image. * @return Returns a reference to this object so that method calls can be chained together. */ public Geometry withBoundingBox(BoundingBox boundingBox) { setBoundingBox(boundingBox); return this; }
/** * <p> * Within the bounding box, a fine-grained polygon around the detected text. * </p> * * @param polygon * Within the bounding box, a fine-grained polygon around the detected text. * @return Returns a reference to this object so that method calls can be chained together. */ public Geometry withPolygon(java.util.Collection<Point> polygon) { setPolygon(polygon); return this; }
public Geometry unmarshall(JsonUnmarshallerContext context) throws Exception { Geometry geometry = new Geometry(); if (context.testExpression("BoundingBox", targetDepth)) { context.nextToken(); geometry.setBoundingBox(BoundingBoxJsonUnmarshaller.getInstance().unmarshall(context)); geometry.setPolygon(new ListUnmarshaller<Point>(PointJsonUnmarshaller.getInstance()).unmarshall(context));
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getDetectedText() == null) ? 0 : getDetectedText().hashCode()); hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); hashCode = prime * hashCode + ((getParentId() == null) ? 0 : getParentId().hashCode()); hashCode = prime * hashCode + ((getConfidence() == null) ? 0 : getConfidence().hashCode()); hashCode = prime * hashCode + ((getGeometry() == null) ? 0 : getGeometry().hashCode()); return hashCode; }
if (other.getGeometry() == null ^ this.getGeometry() == null) return false; if (other.getGeometry() != null && other.getGeometry().equals(this.getGeometry()) == false) return false; return true;
/** * <p> * Within the bounding box, a fine-grained polygon around the detected text. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param polygon <p> * Within the bounding box, a fine-grained polygon around the * detected text. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public Geometry withPolygon(Point... polygon) { if (getPolygon() == null) { this.polygon = new java.util.ArrayList<Point>(polygon.length); } for (Point value : polygon) { this.polygon.add(value); } return this; }
public Geometry unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } Geometry geometry = new Geometry(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("BoundingBox")) { geometry.setBoundingBox(BoundingBoxJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Polygon")) { geometry.setPolygon(new ListUnmarshaller<Point>(PointJsonUnmarshaller.getInstance() ) .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return geometry; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getDetectedText() == null) ? 0 : getDetectedText().hashCode()); hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); hashCode = prime * hashCode + ((getParentId() == null) ? 0 : getParentId().hashCode()); hashCode = prime * hashCode + ((getConfidence() == null) ? 0 : getConfidence().hashCode()); hashCode = prime * hashCode + ((getGeometry() == null) ? 0 : getGeometry().hashCode()); return hashCode; }
if (other.getGeometry() == null ^ this.getGeometry() == null) return false; if (other.getGeometry() != null && other.getGeometry().equals(this.getGeometry()) == false) return false; return true;
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Geometry == false) return false; Geometry other = (Geometry) obj; if (other.getBoundingBox() == null ^ this.getBoundingBox() == null) return false; if (other.getBoundingBox() != null && other.getBoundingBox().equals(this.getBoundingBox()) == false) return false; if (other.getPolygon() == null ^ this.getPolygon() == null) return false; if (other.getPolygon() != null && other.getPolygon().equals(this.getPolygon()) == false) return false; return true; }
/** * <p> * Within the bounding box, a fine-grained polygon around the detected text. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setPolygon(java.util.Collection)} or {@link #withPolygon(java.util.Collection)} if you want to override * the existing values. * </p> * * @param polygon * Within the bounding box, a fine-grained polygon around the detected text. * @return Returns a reference to this object so that method calls can be chained together. */ public Geometry withPolygon(Point... polygon) { if (this.polygon == null) { setPolygon(new java.util.ArrayList<Point>(polygon.length)); } for (Point ele : polygon) { this.polygon.add(ele); } return this; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getBoundingBox() != null) sb.append("BoundingBox: ").append(getBoundingBox()).append(","); if (getPolygon() != null) sb.append("Polygon: ").append(getPolygon()); sb.append("}"); return sb.toString(); }
/** * <p> * Within the bounding box, a fine-grained polygon around the detected text. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param polygon <p> * Within the bounding box, a fine-grained polygon around the * detected text. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public Geometry withPolygon(java.util.Collection<Point> polygon) { setPolygon(polygon); return this; }
/** * Marshall the given parameter object. */ public void marshall(Geometry geometry, ProtocolMarshaller protocolMarshaller) { if (geometry == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(geometry.getBoundingBox(), BOUNDINGBOX_BINDING); protocolMarshaller.marshall(geometry.getPolygon(), POLYGON_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getBoundingBox() == null) ? 0 : getBoundingBox().hashCode()); hashCode = prime * hashCode + ((getPolygon() == null) ? 0 : getPolygon().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Geometry == false) return false; Geometry other = (Geometry) obj; if (other.getBoundingBox() == null ^ this.getBoundingBox() == null) return false; if (other.getBoundingBox() != null && other.getBoundingBox().equals(this.getBoundingBox()) == false) return false; if (other.getPolygon() == null ^ this.getPolygon() == null) return false; if (other.getPolygon() != null && other.getPolygon().equals(this.getPolygon()) == false) return false; return true; } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getBoundingBox() != null) sb.append("BoundingBox: " + getBoundingBox() + ","); if (getPolygon() != null) sb.append("Polygon: " + getPolygon()); sb.append("}"); return sb.toString(); }
public void marshall(Geometry geometry, AwsJsonWriter jsonWriter) throws Exception { jsonWriter.beginObject(); if (geometry.getBoundingBox() != null) { BoundingBox boundingBox = geometry.getBoundingBox(); jsonWriter.name("BoundingBox"); BoundingBoxJsonMarshaller.getInstance().marshall(boundingBox, jsonWriter); } if (geometry.getPolygon() != null) { java.util.List<Point> polygon = geometry.getPolygon(); jsonWriter.name("Polygon"); jsonWriter.beginArray(); for (Point polygonItem : polygon) { if (polygonItem != null) { PointJsonMarshaller.getInstance().marshall(polygonItem, jsonWriter); } } jsonWriter.endArray(); } jsonWriter.endObject(); }