/** * <p> * The dimension name to be matched. * </p> * * @param name * The dimension name to be matched. * @return Returns a reference to this object so that method calls can be chained together. */ public DimensionFilter withName(String name) { setName(name); return this; }
/** * <p> * The value of the dimension to be matched. * </p> * * @param value * The value of the dimension to be matched. * @return Returns a reference to this object so that method calls can be chained together. */ public DimensionFilter withValue(String value) { setValue(value); return this; }
public DimensionFilter unmarshall(StaxUnmarshallerContext context) throws Exception { DimensionFilter dimensionFilter = new DimensionFilter(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return dimensionFilter; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Name", targetDepth)) { dimensionFilter.setName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Value", targetDepth)) { dimensionFilter.setValue(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return dimensionFilter; } } } }
List<DimensionFilter> dimensionFilters = new ArrayList<DimensionFilter>(); for (String dimension: rule.awsDimensions) { dimensionFilters.add(new DimensionFilter().withName(dimension));
public DimensionFilter unmarshall(StaxUnmarshallerContext context) throws Exception { DimensionFilter dimensionFilter = new DimensionFilter(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { int xmlEvent = context.nextEvent(); if (xmlEvent == XmlPullParser.END_DOCUMENT) break; if (xmlEvent == XmlPullParser.START_TAG) { if (context.testExpression("Name", targetDepth)) { dimensionFilter.setName(StringStaxUnmarshaller.getInstance() .unmarshall(context)); continue; } if (context.testExpression("Value", targetDepth)) { dimensionFilter.setValue(StringStaxUnmarshaller.getInstance().unmarshall( context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return dimensionFilter; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DimensionFilter == false) return false; DimensionFilter other = (DimensionFilter) 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(); }
if (dimensionsListValue.getName() != null) { request.addParameter("Dimensions.member." + dimensionsListIndex + ".Name", StringUtils.fromString(dimensionsListValue.getName())); if (dimensionsListValue.getValue() != null) { request.addParameter("Dimensions.member." + dimensionsListIndex + ".Value", StringUtils.fromString(dimensionsListValue.getValue()));
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DimensionFilter == false) return false; DimensionFilter other = (DimensionFilter) 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; 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 (getName() != null) sb.append("Name: " + getName() + ","); if (getValue() != null) sb.append("Value: " + getValue()); sb.append("}"); return sb.toString(); }
public void marshall(DimensionFilter _dimensionFilter, Request<?> request, String _prefix) { String prefix; if (_dimensionFilter.getName() != null) { prefix = _prefix + "Name"; String name = _dimensionFilter.getName(); request.addParameter(prefix, StringUtils.fromString(name)); } if (_dimensionFilter.getValue() != null) { prefix = _prefix + "Value"; String value = _dimensionFilter.getValue(); request.addParameter(prefix, StringUtils.fromString(value)); } }