/** * 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 (getValue() != null) sb.append("Value: ").append(getValue()).append(","); if (getAction() != null) sb.append("Action: ").append(getAction()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AttributeValueUpdate == false) return false; AttributeValueUpdate other = (AttributeValueUpdate) obj; if (other.getValue() == null ^ this.getValue() == null) return false; if (other.getValue() != null && other.getValue().equals(this.getValue()) == false) return false; if (other.getAction() == null ^ this.getAction() == null) return false; if (other.getAction() != null && other.getAction().equals(this.getAction()) == false) return false; return true; }
/** * Converts the {@link AttributeValueUpdate} map given to an equivalent * {@link AttributeValue} map. */ private Map<String, AttributeValue> convertToItem(Map<String, AttributeValueUpdate> putValues) { Map<String, AttributeValue> map = new HashMap<String, AttributeValue>(); for ( Entry<String, AttributeValueUpdate> entry : putValues.entrySet() ) { String attributeName = entry.getKey(); AttributeValue attributeValue = entry.getValue().getValue(); String attributeAction = entry.getValue().getAction(); /* * AttributeValueUpdate allows nulls for its values, since they are * semantically meaningful. AttributeValues never have null values. */ if ( attributeValue != null && !AttributeAction.DELETE.toString().equals(attributeAction)) { map.put(attributeName, attributeValue); } } return map; }
/** * Marshall the given parameter object. */ public void marshall(AttributeValueUpdate attributeValueUpdate, ProtocolMarshaller protocolMarshaller) { if (attributeValueUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(attributeValueUpdate.getValue(), VALUE_BINDING); protocolMarshaller.marshall(attributeValueUpdate.getAction(), ACTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
update.getValue() .withB(entry.getValue().getB()) .withBS(entry.getValue().getBS())
/** * 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 (getValue() != null) sb.append("Value: " + getValue() + ","); if (getAction() != null) sb.append("Action: " + getAction()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AttributeValueUpdate == false) return false; AttributeValueUpdate other = (AttributeValueUpdate) obj; if (other.getValue() == null ^ this.getValue() == null) return false; if (other.getValue() != null && other.getValue().equals(this.getValue()) == false) return false; if (other.getAction() == null ^ this.getAction() == null) return false; if (other.getAction() != null && other.getAction().equals(this.getAction()) == false) return false; return true; } }
/** * Converts the {@link AttributeValueUpdate} map given to an equivalent * {@link AttributeValue} map. */ private Map<String, AttributeValue> convertToItem(Map<String, AttributeValueUpdate> putValues) { final Map<String, AttributeValue> map = new HashMap<String, AttributeValue>(); for (final Entry<String, AttributeValueUpdate> entry : putValues.entrySet()) { final String attributeName = entry.getKey(); final AttributeValue attributeValue = entry.getValue().getValue(); final String attributeAction = entry.getValue().getAction(); /* * AttributeValueUpdate allows nulls for its values, since they are * semantically meaningful. AttributeValues never have null values. */ if (attributeValue != null && !AttributeAction.DELETE.toString().equals(attributeAction)) { map.put(attributeName, attributeValue); } } return map; }
update.getValue() .withB(entry.getValue().getB()) .withBS(entry.getValue().getBS())
public void marshall(AttributeValueUpdate attributeValueUpdate, AwsJsonWriter jsonWriter) throws Exception { jsonWriter.beginObject(); if (attributeValueUpdate.getValue() != null) { AttributeValue value = attributeValueUpdate.getValue(); jsonWriter.name("Value"); AttributeValueJsonMarshaller.getInstance().marshall(value, jsonWriter); } if (attributeValueUpdate.getAction() != null) { String action = attributeValueUpdate.getAction(); jsonWriter.name("Action"); jsonWriter.value(action); } jsonWriter.endObject(); }
@Override public AttributeValue apply(final AttributeValueUpdate update) { return update.getValue(); } }
@Override public AttributeValue apply(final AttributeValueUpdate update) { return update.getValue(); } }
MockTwoValuePlusVersionClass.class, "aws-android-sdk-dynamodbmapper-test", keys, updates, config); assertEquals(transformed.get("firstValue").getValue().getS(), "NEWVALUE1"); assertNull(transformed.get("id"));
public static int calculateItemUpdateSizeInBytes(final Map<String, AttributeValueUpdate> item) { int size = 0; if (item == null) { return size; } for (Map.Entry<String, AttributeValueUpdate> entry : item.entrySet()) { final String name = entry.getKey(); final AttributeValueUpdate update = entry.getValue(); size += name.getBytes(UTF8).length; size += calculateAttributeSizeInBytes(update.getValue()); } return size; }
/** * 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 (getValue() != null) sb.append("Value: ").append(getValue()).append(","); if (getAction() != null) sb.append("Action: ").append(getAction()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AttributeValueUpdate == false) return false; AttributeValueUpdate other = (AttributeValueUpdate) obj; if (other.getValue() == null ^ this.getValue() == null) return false; if (other.getValue() != null && other.getValue().equals(this.getValue()) == false) return false; if (other.getAction() == null ^ this.getAction() == null) return false; if (other.getAction() != null && other.getAction().equals(this.getAction()) == false) return false; return true; }
/** * Marshall the given parameter object. */ public void marshall(AttributeValueUpdate attributeValueUpdate, ProtocolMarshaller protocolMarshaller) { if (attributeValueUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(attributeValueUpdate.getValue(), VALUE_BINDING); protocolMarshaller.marshall(attributeValueUpdate.getAction(), ACTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }