@@ -88,7 +88,7 @@ protected QueryRequest buildQueryRequest(String tableName, String theIndexName,
8888 queryRequest .setIndexName (theIndexName );
8989
9090 if (isApplicableForGlobalSecondaryIndex ()) {
91- List <String > allowedSortProperties = new ArrayList <String >();
91+ List <String > allowedSortProperties = new ArrayList <>();
9292
9393 for (Entry <String , List <Condition >> singlePropertyCondition : propertyConditions .entrySet ()) {
9494 if (entityInformation .getGlobalSecondaryIndexNamesByPropertyName ().keySet ()
@@ -97,7 +97,7 @@ protected QueryRequest buildQueryRequest(String tableName, String theIndexName,
9797 }
9898 }
9999
100- HashMap <String , Condition > keyConditions = new HashMap <String , Condition >();
100+ HashMap <String , Condition > keyConditions = new HashMap <>();
101101
102102 if (hashKeyConditions != null && hashKeyConditions .size () > 0 ) {
103103 for (Condition hashKeyCondition : hashKeyConditions ) {
@@ -130,7 +130,7 @@ protected QueryRequest buildQueryRequest(String tableName, String theIndexName,
130130
131131 queryRequest .setKeyConditions (keyConditions );
132132 queryRequest .setSelect (Select .ALL_PROJECTED_ATTRIBUTES );
133- applySortIfSpecified (queryRequest , new ArrayList <String >(new HashSet <String >(allowedSortProperties )));
133+ applySortIfSpecified (queryRequest , new ArrayList <>(new HashSet <>(allowedSortProperties )));
134134 }
135135 return queryRequest ;
136136 }
@@ -223,11 +223,11 @@ protected List<Condition> getHashKeyConditions() {
223223
224224 public AbstractDynamoDBQueryCriteria (DynamoDBEntityInformation <T , ID > dynamoDBEntityInformation , final DynamoDBMapperTableModel <T > tableModel ) {
225225 this .clazz = dynamoDBEntityInformation .getJavaType ();
226- this .attributeConditions = new LinkedMultiValueMap <String , Condition >();
227- this .propertyConditions = new LinkedMultiValueMap <String , Condition >();
226+ this .attributeConditions = new LinkedMultiValueMap <>();
227+ this .propertyConditions = new LinkedMultiValueMap <>();
228228 this .hashKeyPropertyName = dynamoDBEntityInformation .getHashKeyPropertyName ();
229229 this .entityInformation = dynamoDBEntityInformation ;
230- this .attributeNamesByPropertyName = new HashMap <String , String >();
230+ this .attributeNamesByPropertyName = new HashMap <>();
231231 // TODO consider adding the DynamoDBMapper table model to DynamoDBEntityInformation instead
232232 this .tableModel = tableModel ;
233233 }
@@ -257,10 +257,10 @@ protected String getGlobalSecondaryIndexName() {
257257 if (globalSecondaryIndexName == null && attributeConditions != null && !attributeConditions .isEmpty ())
258258 {
259259 // Declare map of index names by attribute name which we will populate below - this will be used to determine which index to use if multiple indexes are applicable
260- Map <String ,String []> indexNamesByAttributeName = new HashMap <String , String [] >();
260+ Map <String , String []> indexNamesByAttributeName = new HashMap <>();
261261
262262 // Declare map of attribute lists by index name which we will populate below - this will be used to determine whether we have an exact match index for specified attribute conditions
263- MultiValueMap <String ,String > attributeListsByIndexName = new LinkedMultiValueMap <String , String >();
263+ MultiValueMap <String , String > attributeListsByIndexName = new LinkedMultiValueMap <>();
264264
265265 // Populate the above maps
266266 for (Entry <String , String []> indexNamesForPropertyNameEntry : entityInformation .getGlobalSecondaryIndexNamesByPropertyName ().entrySet ())
@@ -275,8 +275,8 @@ protected String getGlobalSecondaryIndexName() {
275275 }
276276
277277 // Declare lists to store matching index names
278- List <String > exactMatchIndexNames = new ArrayList <String >();
279- List <String > partialMatchIndexNames = new ArrayList <String >();
278+ List <String > exactMatchIndexNames = new ArrayList <>();
279+ List <String > partialMatchIndexNames = new ArrayList <>();
280280
281281 // Populate matching index name lists - an index is either an exact match ( the index attributes match all the specified criteria exactly)
282282 // or a partial match ( the properties for the specified criteria are contained within the property set for an index )
@@ -412,8 +412,7 @@ public Object getHashKeyPropertyValue() {
412412 protected String getAttributeName (String propertyName ) {
413413 String attributeName = attributeNamesByPropertyName .get (propertyName );
414414 if (attributeName == null ) {
415- String overriddenName = entityInformation .getOverriddenAttributeName (propertyName );
416- attributeName = overriddenName != null ? overriddenName : propertyName ;
415+ attributeName = entityInformation .getOverriddenAttributeName (propertyName ).orElse (propertyName );
417416 attributeNamesByPropertyName .put (propertyName , attributeName );
418417 }
419418 return attributeName ;
@@ -498,7 +497,11 @@ protected <V extends Object> Object getPropertyAttributeValue(final String prope
498497 if (marshaller != null ) {
499498 return marshaller .marshall (value );
500499 } else if (tableModel != null ) { // purely here for testing as DynamoDBMapperTableModel cannot be mocked using Mockito
501- DynamoDBMapperFieldModel <T ,Object > fieldModel = tableModel .field (propertyName );
500+
501+ String attributeName = getAttributeName (propertyName );
502+ entityInformation .getOverriddenAttributeName (propertyName ).orElse (propertyName );
503+
504+ DynamoDBMapperFieldModel <T ,Object > fieldModel = tableModel .field (attributeName );
502505 if (fieldModel != null ) {
503506 return fieldModel .convert (value );
504507 }
@@ -515,7 +518,7 @@ protected <V> Condition createNoValueCondition(String propertyName, ComparisonOp
515518 }
516519
517520 private List <String > getNumberListAsStringList (List <Number > numberList ) {
518- List <String > list = new ArrayList <String >();
521+ List <String > list = new ArrayList <>();
519522 for (Number number : numberList ) {
520523 if (number != null ) {
521524 list .add (number .toString ());
@@ -541,7 +544,7 @@ private List<String> getDateListAsStringList(List<Date> dateList) {
541544
542545 private List <String > getInstantListAsStringList (List <Instant > dateList ) {
543546 DynamoDBMarshaller <Instant > marshaller = new Instant2IsoDynamoDBMarshaller ();
544- List <String > list = new ArrayList <String >();
547+ List <String > list = new ArrayList <>();
545548 for (Instant date : dateList ) {
546549 if (date != null ) {
547550 list .add (marshaller .marshall (date ));
@@ -553,7 +556,7 @@ private List<String> getInstantListAsStringList(List<Instant> dateList) {
553556 }
554557
555558 private List <String > getBooleanListAsStringList (List <Boolean > booleanList ) {
556- List <String > list = new ArrayList <String >();
559+ List <String > list = new ArrayList <>();
557560 for (Boolean booleanValue : booleanList ) {
558561 if (booleanValue != null ) {
559562 list .add (booleanValue .booleanValue () ? "1" : "0" );
@@ -567,9 +570,8 @@ private List<String> getBooleanListAsStringList(List<Boolean> booleanList) {
567570 @ SuppressWarnings ("unchecked" )
568571 private <P > List <P > getAttributeValueAsList (Object attributeValue ) {
569572 boolean isIterable = ClassUtils .isAssignable (Iterable .class , attributeValue .getClass ());
570- List <P > attributeValueAsList = null ;
571573 if (isIterable ) {
572- attributeValueAsList = new ArrayList <P >();
574+ List < P > attributeValueAsList = new ArrayList <>();
573575 Iterable <P > iterable = (Iterable <P >) attributeValue ;
574576 for (P attributeValueElement : iterable ) {
575577 attributeValueAsList .add (attributeValueElement );
@@ -643,7 +645,7 @@ protected Condition createSingleValueCondition(String propertyName, ComparisonOp
643645 Assert .notNull (o , "Creating conditions on null property values not supported: please specify a value for '"
644646 + propertyName + "'" );
645647
646- List <AttributeValue > attributeValueList = new ArrayList <AttributeValue >();
648+ List <AttributeValue > attributeValueList = new ArrayList <>();
647649 Object attributeValue = !alreadyMarshalledIfRequired ? getPropertyAttributeValue (propertyName , o ) : o ;
648650 if (ClassUtils .isAssignableValue (AttributeValue .class , attributeValue )) {
649651 attributeValueList .add ((AttributeValue ) attributeValue );
0 commit comments