本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.KeyType.HASH属性的典型用法代码示例。如果您正苦于以下问题:Java KeyType.HASH属性的具体用法?Java KeyType.HASH怎么用?Java KeyType.HASH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.amazonaws.services.dynamodbv2.model.KeyType
的用法示例。
在下文中一共展示了KeyType.HASH属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recordSizeViolation
/** For GSI Violation value, should store them with their attribute type */
protected void recordSizeViolation(AttributeValue keyValue, int size, KeyType keyType) {
if (keyType == KeyType.HASH) {
if (recordGsiValueInViolationRecord) {
violationRecord.setGSIHashKey(AttributeValueConverter.toStringWithAttributeType(keyValue));
}
violationRecord.setGSIHashKeyViolationType(SIZE_VIOLATION);
violationRecord.setGSIHashKeyViolationDesc("Max Bytes Allowed: " + MAX_HASH_KEY_SIZE + " Found: " + size);
} else if (keyType == KeyType.RANGE) {
if (recordGsiValueInViolationRecord) {
violationRecord.setGSIRangeKey(AttributeValueConverter.toStringWithAttributeType(keyValue));
}
violationRecord.setGSIRangeKeyViolationType(SIZE_VIOLATION);
violationRecord.setGSIRangeKeyViolationDesc("Max Bytes Allowed: " + MAX_RANGE_KEY_SIZE + " Found: " + size);
}
}
示例2: recordTypeViolation
protected void recordTypeViolation(AttributeValue keyValue, KeyType keyType, String expectedDatatype, String foundDatatype) {
if (keyType == KeyType.HASH) {
if (recordGsiValueInViolationRecord) {
violationRecord.setGSIHashKey(AttributeValueConverter.toStringWithAttributeType(keyValue));
}
violationRecord.setGSIHashKeyViolationType(TYPE_VIOLATION);
violationRecord.setGSIHashKeyViolationDesc("Expected: " + expectedDatatype + " Found: " + foundDatatype);
} else {
if (recordGsiValueInViolationRecord) {
violationRecord.setGSIRangeKey(AttributeValueConverter.toStringWithAttributeType(keyValue));
}
violationRecord.setGSIRangeKeyViolationType(TYPE_VIOLATION);
violationRecord.setGSIRangeKeyViolationDesc("Expected: " + expectedDatatype + " Found: " + foundDatatype);
}
}
示例3: setKeySchema
/**
* Sets the hash key schema for the specified table
*
* @param tableName
* @param keyName
* @param keyType
*/
public void setKeySchema(String tableName, String keyName, String keyType) {
ArrayList<KeySchemaElement> kSchema = tablesToKeySchemas.get(tableName);
if (kSchema == null) {
kSchema = new ArrayList<KeySchemaElement>();
tablesToKeySchemas.put(tableName, kSchema);
}
KeyType type = keyType.equals(DYNAMO_KEY_HASHRANGE) ? KeyType.RANGE : KeyType.HASH;
kSchema.add(new KeySchemaElement().withAttributeName(keyName)
.withKeyType(type));
}
示例4: getKeyType
private KeyType getKeyType(String remarks) {
if ("RANGE".equals(remarks)) {
// default
return KeyType.RANGE;
}
return KeyType.HASH;
}