if (indexRangeKey != null && !indexRangeKey.attributeName().isEmpty()) { return indexRangeKey.attributeName();
if (!indexRangeKey.globalSecondaryIndexName().isEmpty()) { if (indexRangeKey.globalSecondaryIndexNames().length > 0) { throw new DynamoDBMappingException("@DynamoDBIndexRangeKey must not specify both RANGE GSI name/names"); gsis.put(RANGE, Collections.singletonList(indexRangeKey.globalSecondaryIndexName())); } else if (indexRangeKey.globalSecondaryIndexNames().length > 0) { gsis.put(RANGE, Collections.unmodifiableList(Arrays.asList(indexRangeKey.globalSecondaryIndexNames()))); } else if (localSecondaryIndexNames().isEmpty()) { throw new DynamoDBMappingException("@DynamoDBIndexRangeKey must specify RANGE GSI and/or LSI name/names");
/** * {@inheritDoc} */ @Override public List<String> localSecondaryIndexNames() { final DynamoDBIndexRangeKey annotation = actualOf(DynamoDBIndexRangeKey.class); if (annotation != null) { if (!annotation.localSecondaryIndexName().isEmpty()) { if (annotation.localSecondaryIndexNames().length > 0) { throw new DynamoDBMappingException("@DynamoDBIndexRangeKey must not specify both LSI name/names"); } return Collections.singletonList(annotation.localSecondaryIndexName()); } else if (annotation.localSecondaryIndexNames().length > 0) { return Collections.unmodifiableList(Arrays.asList(annotation.localSecondaryIndexNames())); } } return Collections.<String>emptyList(); } }
@DynamoDBIndexRangeKey( attributeName = ENVIRONMENT_CLUSTER_INDEX_RANGE_KEY, globalSecondaryIndexName = ENVIRONMENT_CLUSTER_GSI_NAME
private void addGlobalSecondaryIndexNames(Field field, DynamoDBIndexRangeKey dynamoDBIndexRangeKey) { if (dynamoDBIndexRangeKey.globalSecondaryIndexNames() != null && dynamoDBIndexRangeKey.globalSecondaryIndexNames().length > 0) { String propertyName = getPropertyNameForField(field); globalSecondaryIndexNames.put(propertyName, field.getAnnotation(DynamoDBIndexRangeKey.class).globalSecondaryIndexNames()); globalIndexRangeKeyPropertyNames.add(propertyName); } if (dynamoDBIndexRangeKey.globalSecondaryIndexName() != null && dynamoDBIndexRangeKey.globalSecondaryIndexName().trim().length() > 0) { String propertyName = getPropertyNameForField(field); globalSecondaryIndexNames.put(propertyName, new String[]{field.getAnnotation(DynamoDBIndexRangeKey.class).globalSecondaryIndexName()}); globalIndexRangeKeyPropertyNames.add(propertyName); } }
public void doWith(Method method) { if (method.getAnnotation(DynamoDBIndexRangeKey.class) != null) { if ((method.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName() != null && method .getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName().trim().length() > 0) || (method.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames() != null && method .getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames().length > 0)) { propertyNames.add(getPropertyNameForAccessorMethod(method)); } } } });
attributeName = indexRangeKey.attributeName(); if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName);
private void addGlobalSecondaryIndexNames(Method method, DynamoDBIndexRangeKey dynamoDBIndexRangeKey) { if (dynamoDBIndexRangeKey.globalSecondaryIndexNames() != null && dynamoDBIndexRangeKey.globalSecondaryIndexNames().length > 0) { String propertyName = getPropertyNameForAccessorMethod(method); globalSecondaryIndexNames.put(propertyName, method.getAnnotation(DynamoDBIndexRangeKey.class).globalSecondaryIndexNames()); globalIndexRangeKeyPropertyNames.add(propertyName); } if (dynamoDBIndexRangeKey.globalSecondaryIndexName() != null && dynamoDBIndexRangeKey.globalSecondaryIndexName().trim().length() > 0) { String propertyName = getPropertyNameForAccessorMethod(method); globalSecondaryIndexNames.put(propertyName, new String[]{method.getAnnotation(DynamoDBIndexRangeKey.class).globalSecondaryIndexName()}); globalIndexRangeKeyPropertyNames.add(propertyName); } }
public void doWith(Field field) { if (field.getAnnotation(DynamoDBIndexRangeKey.class) != null) { if ((field.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName() != null && field .getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName().trim().length() > 0) || (field.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames() != null && field .getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames().length > 0)) { propertyNames.add(getPropertyNameForField(field)); } } } });
public String getOverriddenAttributeName(Method method) { if (method != null) { if (method.getAnnotation(DynamoDBAttribute.class) != null && !StringUtils.isEmpty(method.getAnnotation(DynamoDBAttribute.class).attributeName())) { return method.getAnnotation(DynamoDBAttribute.class).attributeName(); } if (method.getAnnotation(DynamoDBHashKey.class) != null && !StringUtils.isEmpty(method.getAnnotation(DynamoDBHashKey.class).attributeName())) { return method.getAnnotation(DynamoDBHashKey.class).attributeName(); } if (method.getAnnotation(DynamoDBRangeKey.class) != null && !StringUtils.isEmpty(method.getAnnotation(DynamoDBRangeKey.class).attributeName())) { return method.getAnnotation(DynamoDBRangeKey.class).attributeName(); } if (method.getAnnotation(DynamoDBIndexRangeKey.class) != null && !StringUtils.isEmpty(method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName())) { return method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName(); } if (method.getAnnotation(DynamoDBIndexHashKey.class) != null && !StringUtils.isEmpty(method.getAnnotation(DynamoDBIndexHashKey.class).attributeName())) { return method.getAnnotation(DynamoDBIndexHashKey.class).attributeName(); } if (method.getAnnotation(DynamoDBVersionAttribute.class) != null && !StringUtils.isEmpty(method.getAnnotation(DynamoDBVersionAttribute.class).attributeName())) { return method.getAnnotation(DynamoDBVersionAttribute.class).attributeName(); } } return null; }
private void addGlobalSecondaryIndexNames(Method method, DynamoDBIndexRangeKey dynamoDBIndexRangeKey) { if (dynamoDBIndexRangeKey.globalSecondaryIndexNames() != null && dynamoDBIndexRangeKey.globalSecondaryIndexNames().length > 0) { String propertyName = getPropertyNameForAccessorMethod(method); globalSecondaryIndexNames.put(propertyName, method.getAnnotation(DynamoDBIndexRangeKey.class) .globalSecondaryIndexNames()); globalIndexRangeKeyPropertyNames.add(propertyName); } if (dynamoDBIndexRangeKey.globalSecondaryIndexName() != null && dynamoDBIndexRangeKey.globalSecondaryIndexName().trim().length() > 0) { String propertyName = getPropertyNameForAccessorMethod(method); globalSecondaryIndexNames.put(propertyName, new String[] { method.getAnnotation(DynamoDBIndexRangeKey.class).globalSecondaryIndexName() }); globalIndexRangeKeyPropertyNames.add(propertyName); } }
/** * {@inheritDoc} */ @Override public List<String> localSecondaryIndexNames() { final DynamoDBIndexRangeKey annotation = actualOf(DynamoDBIndexRangeKey.class); if (annotation != null) { if (!annotation.localSecondaryIndexName().isEmpty()) { if (annotation.localSecondaryIndexNames().length > 0) { throw new DynamoDBMappingException("@DynamoDBIndexRangeKey must not specify both LSI name/names"); } return Collections.singletonList(annotation.localSecondaryIndexName()); } else if (annotation.localSecondaryIndexNames().length > 0) { return Collections.unmodifiableList(Arrays.asList(annotation.localSecondaryIndexNames())); } } return Collections.<String>emptyList(); } }
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; }
private void addGlobalSecondaryIndexNames(Field field, DynamoDBIndexRangeKey dynamoDBIndexRangeKey) { if (dynamoDBIndexRangeKey.globalSecondaryIndexNames() != null && dynamoDBIndexRangeKey.globalSecondaryIndexNames().length > 0) { String propertyName = getPropertyNameForField(field); globalSecondaryIndexNames.put(propertyName, field.getAnnotation(DynamoDBIndexRangeKey.class) .globalSecondaryIndexNames()); globalIndexRangeKeyPropertyNames.add(propertyName); } if (dynamoDBIndexRangeKey.globalSecondaryIndexName() != null && dynamoDBIndexRangeKey.globalSecondaryIndexName().trim().length() > 0) { String propertyName = getPropertyNameForField(field); globalSecondaryIndexNames.put(propertyName, new String[] { field.getAnnotation(DynamoDBIndexRangeKey.class).globalSecondaryIndexName() }); globalIndexRangeKeyPropertyNames.add(propertyName); } }
@Override public Set<String> getIndexRangeKeyPropertyNames() { final Set<String> propertyNames = new HashSet<>(); ReflectionUtils.doWithMethods(getJavaType(), method -> { if (method.getAnnotation(DynamoDBIndexRangeKey.class) != null) { if ((method.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName() != null && method .getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName().trim().length() > 0) || (method.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames() != null && method.getAnnotation(DynamoDBIndexRangeKey.class) .localSecondaryIndexNames().length > 0)) { propertyNames.add(getPropertyNameForAccessorMethod(method)); } } }); ReflectionUtils.doWithFields(getJavaType(), field -> { if (field.getAnnotation(DynamoDBIndexRangeKey.class) != null) { if ((field.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName() != null && field .getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName().trim().length() > 0) || (field.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames() != null && field .getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames().length > 0)) { propertyNames.add(getPropertyNameForField(field)); } } }); return propertyNames; }
&& !StringUtils.isEmpty(method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName())) { return Optional.of(method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName()); && !StringUtils.isEmpty(field.getAnnotation(DynamoDBIndexRangeKey.class).attributeName())) { return Optional.of(field.getAnnotation(DynamoDBIndexRangeKey.class).attributeName());
if (!indexRangeKey.globalSecondaryIndexName().isEmpty()) { if (indexRangeKey.globalSecondaryIndexNames().length > 0) { throw new DynamoDBMappingException("@DynamoDBIndexRangeKey must not specify both RANGE GSI name/names"); gsis.put(RANGE, Collections.singletonList(indexRangeKey.globalSecondaryIndexName())); } else if (indexRangeKey.globalSecondaryIndexNames().length > 0) { gsis.put(RANGE, Collections.unmodifiableList(Arrays.asList(indexRangeKey.globalSecondaryIndexNames()))); } else if (localSecondaryIndexNames().isEmpty()) { throw new DynamoDBMappingException("@DynamoDBIndexRangeKey must specify RANGE GSI and/or LSI name/names");
&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName())) { return method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName(); && StringUtils.isNotEmpty(field.getAnnotation(DynamoDBIndexRangeKey.class).attributeName())) { return field.getAnnotation(DynamoDBIndexRangeKey.class).attributeName();
if (indexRangeKey != null && !indexRangeKey.attributeName().isEmpty()) { return indexRangeKey.attributeName();
attributeName = indexRangeKey.attributeName(); if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName);