本文整理汇总了Java中com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey类的典型用法代码示例。如果您正苦于以下问题:Java DynamoDBHashKey类的具体用法?Java DynamoDBHashKey怎么用?Java DynamoDBHashKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DynamoDBHashKey类属于com.amazonaws.services.dynamodbv2.datamodeling包,在下文中一共展示了DynamoDBHashKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTable
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
/***
* Create the table and the associated indexes if it does not already exist
* @param reflections
* @param clazz
*/
private CreateTableResult createTable(Class<?> clazz) {
final String tableName = this.getClassAnnotationValue(clazz, DynamoDBTable.class, String.class, "tableName");
final Method hashKeyMember = this.getMethodForAnnotation(clazz, DynamoDBHashKey.class);
final DynamoDBHashKey hashKeyAnno = hashKeyMember.getAnnotation(DynamoDBHashKey.class);
final String hashKeyName = this.getAnnotationValue(hashKeyAnno, "attributeName", String.class);
String rangeKeyName = null;
final Method rangeKeyMember = this.getMethodForAnnotation(clazz, DynamoDBRangeKey.class);
if(rangeKeyMember!=null){
DynamoDBRangeKey rangeKeyAnno = rangeKeyMember.getAnnotation(DynamoDBRangeKey.class);
rangeKeyName = this.getAnnotationValue(rangeKeyAnno, "attributeName", String.class);
}
final Set<Method> hashKeyIndexFields = this.getMethodsAnnotatedWith(DynamoDBIndexHashKey.class, clazz);
final Set<Method> rangeKeyIndexFields = this.getMethodsAnnotatedWith(DynamoDBIndexRangeKey.class, clazz);
final Map<String, GlobalIndex> globalIndexes = this.createGlobalIndexes(hashKeyIndexFields, rangeKeyIndexFields, clazz);
final Map<String, RangeKeyIndexField> localIndexes = this.createLocalIndexMap(rangeKeyIndexFields);
final CreateTableRequest tableRequest = this.createCreateTableRequest(tableName, hashKeyName, rangeKeyName, globalIndexes, localIndexes);
final CreateTableResult result = this.client.createTable(tableRequest);
return result;
}
示例2: shouldCreatePersistentEntityFor
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@Override
protected boolean shouldCreatePersistentEntityFor(TypeInformation<?> type) {
boolean hasHashKey = false;
boolean hasRangeKey = false;
for (Method method : type.getType().getMethods()) {
if (method.isAnnotationPresent(DynamoDBHashKey.class))
hasHashKey = true;
if (method.isAnnotationPresent(DynamoDBRangeKey.class))
hasRangeKey = true;
}
for (Field field : type.getType().getFields()) {
if (field.isAnnotationPresent(DynamoDBHashKey.class))
hasHashKey = true;
if (field.isAnnotationPresent(DynamoDBRangeKey.class))
hasRangeKey = true;
}
return type.getType().isAnnotationPresent(DynamoDBTable.class) || (hasHashKey && hasRangeKey);
}
示例3: DynamoDBHashAndRangeKeyExtractingEntityMetadataImpl
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
public DynamoDBHashAndRangeKeyExtractingEntityMetadataImpl(final Class<T> domainType) {
super(domainType);
this.hashAndRangeKeyMethodExtractor = new DynamoDBHashAndRangeKeyMethodExtractorImpl<T>(getJavaType());
ReflectionUtils.doWithMethods(domainType, new MethodCallback() {
public void doWith(Method method) {
if (method.getAnnotation(DynamoDBHashKey.class) != null) {
String setterMethodName = toSetterMethodNameFromAccessorMethod(method);
if (setterMethodName != null) {
hashKeySetterMethod = ReflectionUtils.findMethod(domainType, setterMethodName, method.getReturnType());
}
}
}
});
ReflectionUtils.doWithFields(domainType, new FieldCallback() {
public void doWith(Field field) {
if (field.getAnnotation(DynamoDBHashKey.class) != null) {
hashKeyField = ReflectionUtils.findField(domainType, field.getName());
}
}
});
Assert.isTrue(hashKeySetterMethod != null || hashKeyField != null, "Unable to find hash key field or setter method on " + domainType + "!");
Assert.isTrue(hashKeySetterMethod == null || hashKeyField == null, "Found both hash key field and setter method on " + domainType + "!");
}
开发者ID:michaellavelle,项目名称:spring-data-dynamodb,代码行数:27,代码来源:DynamoDBHashAndRangeKeyExtractingEntityMetadataImpl.java
示例4: getUuid
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
/**
* The UUID that uniquely identifies this item.
*
* @return The UUID.
*/
@DynamoDBHashKey(attributeName = "Uuid")
@DynamoDBAutoGeneratedKey
public String getUuid() {
return uuid;
}
示例5: getPrimaryHashKey
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@DynamoDBHashKey
@DynamoDBIndexHashKey (
globalSecondaryIndexNames = {
"GSI-primary-hash-index-range-1",
"GSI-primary-hash-index-range-2"}
)
public String getPrimaryHashKey() {
return primaryHashKey;
}
示例6: getOverriddenAttributeName
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
public String getOverriddenAttributeName(Method method) {
if (method != null) {
if (method.getAnnotation(DynamoDBAttribute.class) != null
&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBAttribute.class).attributeName())) {
return method.getAnnotation(DynamoDBAttribute.class).attributeName();
}
if (method.getAnnotation(DynamoDBHashKey.class) != null
&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBHashKey.class).attributeName())) {
return method.getAnnotation(DynamoDBHashKey.class).attributeName();
}
if (method.getAnnotation(DynamoDBRangeKey.class) != null
&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBRangeKey.class).attributeName())) {
return method.getAnnotation(DynamoDBRangeKey.class).attributeName();
}
if (method.getAnnotation(DynamoDBIndexRangeKey.class) != null
&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName())) {
return method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName();
}
if (method.getAnnotation(DynamoDBIndexHashKey.class) != null
&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBIndexHashKey.class).attributeName())) {
return method.getAnnotation(DynamoDBIndexHashKey.class).attributeName();
}
if (method.getAnnotation(DynamoDBVersionAttribute.class) != null
&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBVersionAttribute.class).attributeName())) {
return method.getAnnotation(DynamoDBVersionAttribute.class).attributeName();
}
}
return null;
}
示例7: getId
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@DynamoDBHashKey
public String getId() {
return id;
}
示例8: getId
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@DynamoDBHashKey
public String getId() {
return id;
}
示例9: getOrderId
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@DynamoDBHashKey(attributeName = "order_id")
public String getOrderId() {
return orderId;
}
示例10: getProductId
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@DynamoDBHashKey(attributeName = "product_id")
public String getProductId() {
return productId;
}
示例11: getUserId
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@DynamoDBHashKey(attributeName="user_id")
public String getUserId() {
return userId;
}
示例12: getUserId
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@Override
@DynamoDBHashKey(attributeName = "user_id")
public String getUserId() {
return super.getUserId();
}
示例13: getId
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@DynamoDBHashKey(attributeName = "_id")
public String getId() {
return id;
}
示例14: getRequestID
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@DynamoDBAutoGeneratedKey
@DynamoDBHashKey(attributeName = "RequestID")
public String getRequestID() {
return requestID;
}
示例15: getDomainName
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; //导入依赖的package包/类
@DynamoDBHashKey
public String getDomainName() { return domainName; }