/** * <p> * For the metric that the CloudWatch alarm is associated with, the name of one dimension. * </p> * * @param name * For the metric that the CloudWatch alarm is associated with, the name of one dimension. * @return Returns a reference to this object so that method calls can be chained together. */ public Dimension withName(String name) { setName(name); return this; }
/** * <p> * For the metric that the CloudWatch alarm is associated with, the value of one dimension. * </p> * * @param value * For the metric that the CloudWatch alarm is associated with, the value of one dimension. * @return Returns a reference to this object so that method calls can be chained together. */ public Dimension withValue(String value) { setValue(value); return this; }
public Dimension unmarshall(StaxUnmarshallerContext context) throws Exception { Dimension dimension = new Dimension(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return dimension; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Name", targetDepth)) { dimension.setName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Value", targetDepth)) { dimension.setValue(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return dimension; } } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Dimension == false) return false; Dimension other = (Dimension) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getValue() == null ^ this.getValue() == null) return false; if (other.getValue() != null && other.getValue().equals(this.getValue()) == false) return false; return true; }
/** * 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 (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getValue() != null) sb.append("Value: ").append(getValue()); sb.append("}"); return sb.toString(); }