@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAttributeName() == null) ? 0 : getAttributeName().hashCode()); hashCode = prime * hashCode + ((getAttributeType() == null) ? 0 : getAttributeType().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AttributeDefinition == false) return false; AttributeDefinition other = (AttributeDefinition) obj; if (other.getAttributeName() == null ^ this.getAttributeName() == null) return false; if (other.getAttributeName() != null && other.getAttributeName().equals(this.getAttributeName()) == false) return false; if (other.getAttributeType() == null ^ this.getAttributeType() == null) return false; if (other.getAttributeType() != null && other.getAttributeType().equals(this.getAttributeType()) == 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 (getAttributeName() != null) sb.append("AttributeName: ").append(getAttributeName()).append(","); if (getAttributeType() != null) sb.append("AttributeType: ").append(getAttributeType()); sb.append("}"); return sb.toString(); }
/** * Marshall the given parameter object. */ public void marshall(AttributeDefinition attributeDefinition, ProtocolMarshaller protocolMarshaller) { if (attributeDefinition == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(attributeDefinition.getAttributeName(), ATTRIBUTENAME_BINDING); protocolMarshaller.marshall(attributeDefinition.getAttributeType(), ATTRIBUTETYPE_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 + ((getAttributeName() == null) ? 0 : getAttributeName().hashCode()); hashCode = prime * hashCode + ((getAttributeType() == null) ? 0 : getAttributeType().hashCode()); return hashCode; }
/** * 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 (getAttributeName() != null) sb.append("AttributeName: " + getAttributeName() + ","); if (getAttributeType() != null) sb.append("AttributeType: " + getAttributeType()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AttributeDefinition == false) return false; AttributeDefinition other = (AttributeDefinition) obj; if (other.getAttributeName() == null ^ this.getAttributeName() == null) return false; if (other.getAttributeName() != null && other.getAttributeName().equals(this.getAttributeName()) == false) return false; if (other.getAttributeType() == null ^ this.getAttributeType() == null) return false; if (other.getAttributeType() != null && other.getAttributeType().equals(this.getAttributeType()) == false) return false; return true; } }
public void marshall(AttributeDefinition attributeDefinition, AwsJsonWriter jsonWriter) throws Exception { jsonWriter.beginObject(); if (attributeDefinition.getAttributeName() != null) { String attributeName = attributeDefinition.getAttributeName(); jsonWriter.name("AttributeName"); jsonWriter.value(attributeName); } if (attributeDefinition.getAttributeType() != null) { String attributeType = attributeDefinition.getAttributeType(); jsonWriter.name("AttributeType"); jsonWriter.value(attributeType); } jsonWriter.endObject(); }
final KeyDescription kd = new KeyDescription(); kd.setHash("HASH".equalsIgnoreCase(element.getKeyType())); kd.setType(getType(ad.getAttributeType())); if (kd.isHash()) { this.hashKeys.add(keyName);
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAttributeName() == null) ? 0 : getAttributeName().hashCode()); hashCode = prime * hashCode + ((getAttributeType() == null) ? 0 : getAttributeType().hashCode()); return hashCode; }
@Override public int compare(AttributeDefinition arg0, AttributeDefinition arg1) { if(arg0 == null) return -1; if(arg1 == null) return 1; int comp = arg0.getAttributeName().compareTo(arg1.getAttributeName()); if(comp != 0) return comp; comp = arg0.getAttributeType().compareTo(arg1.getAttributeType()); return comp; }
/** * 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 (getAttributeName() != null) sb.append("AttributeName: ").append(getAttributeName()).append(","); if (getAttributeType() != null) sb.append("AttributeType: ").append(getAttributeType()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AttributeDefinition == false) return false; AttributeDefinition other = (AttributeDefinition) obj; if (other.getAttributeName() == null ^ this.getAttributeName() == null) return false; if (other.getAttributeName() != null && other.getAttributeName().equals(this.getAttributeName()) == false) return false; if (other.getAttributeType() == null ^ this.getAttributeType() == null) return false; if (other.getAttributeType() != null && other.getAttributeType().equals(this.getAttributeType()) == false) return false; return true; }
/** * Marshall the given parameter object. */ public void marshall(AttributeDefinition attributeDefinition, ProtocolMarshaller protocolMarshaller) { if (attributeDefinition == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(attributeDefinition.getAttributeName(), ATTRIBUTENAME_BINDING); protocolMarshaller.marshall(attributeDefinition.getAttributeType(), ATTRIBUTETYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
final TableDescription description = table.describe(); System.out.println(description.getAttributeDefinitions()); final List<AttributeDefinition> tableAttributeDefinitions = description.getAttributeDefinitions(); for (GlobalSecondaryIndexDescription gsi : description .getGlobalSecondaryIndexes()) { System.out.println("IndexName: " + gsi.getIndexName()); for (KeySchemaElement keySchemaElement : gsi.getKeySchema()) { final String attrName = keySchemaElement.getAttributeName(); final AttributeDefinition attrDef = tableAttributeDefinitions.stream() .filter(ad -> ad.getAttributeName().equals(attrName)).findFirst() .orElseThrow(RuntimeException::new); System.out.println( "AttributeName: " + attrDef.getAttributeName() + ", AttributeType: " + attrDef.getAttributeType()); } }
TableColumnType type = TableColumnType.text; switch(attributeDefinition.getAttributeType()) { case "N": type = TableColumnType.numeric;
table.addColumn(column); final String attributeType = attributeDefinition.getAttributeType(); column.setType(DynamoDbUtils.toColumnType(attributeName, attributeType)); column.setIndexed(true);