Skip to content

Commit 22f85da

Browse files
committed
Adding Javadoc to all methods. Removing unnecessary function.
1 parent 8aa0925 commit 22f85da

17 files changed

Lines changed: 84 additions & 37 deletions

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/DynamoDbComparisonType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static DynamoDbComparisonType fromToken(String token) {
4444
/**
4545
* Creates a comparison operation instance for this comparison type.
4646
*
47-
* @param fieldName compared field name/path
47+
* @param fieldName field name coming from DynamoDB expression/condition
4848
* @param value comparison value
4949
* @return concrete comparison operation
5050
*/

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/DynamoDbExpressionParser.java

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,10 @@ private void prepareParser(Parser parser) {
7777
}
7878

7979
/**
80-
* Parses and resolves a field path from Parser context.
80+
* Resolves expression-attribute-name aliases in a dotted field name.
8181
*
82-
* @param pathContext the parsed path context
83-
* @return resolved field path with attribute-name aliases expanded
84-
*/
85-
private String parsePath(DynamoDbConditionExpressionParser.PathContext pathContext) {
86-
return parseFieldName(pathContext.getText());
87-
}
88-
89-
/**
90-
* Resolves expression-attribute-name aliases in a dotted field path.
91-
*
92-
* @param token raw field token from the expression
93-
* @return resolved field path
82+
* @param token raw field token coming from DynamoDB expression/condition
83+
* @return resolved field name coming from DynamoDB expression/condition
9484
*/
9585
private String parseFieldName(String token) {
9686
String[] chunks = token.split("\\.");
@@ -274,38 +264,38 @@ public QueryOperation visitPredicatePrimary(DynamoDbConditionExpressionParser.Pr
274264
/** {@inheritDoc} */
275265
@Override
276266
public QueryOperation visitAttributeExistsPredicate(DynamoDbConditionExpressionParser.AttributeExistsPredicateContext ctx) {
277-
return new ExistsOperation(parsePath(ctx.path()), true);
267+
return new ExistsOperation(parseFieldName(ctx.path().getText()), true);
278268
}
279269

280270
/** {@inheritDoc} */
281271
@Override
282272
public QueryOperation visitAttributeNotExistsPredicate(DynamoDbConditionExpressionParser.AttributeNotExistsPredicateContext ctx) {
283-
return new ExistsOperation(parsePath(ctx.path()), false);
273+
return new ExistsOperation(parseFieldName(ctx.path().getText()), false);
284274
}
285275

286276
/** {@inheritDoc} */
287277
@Override
288278
public QueryOperation visitAttributeTypePredicate(DynamoDbConditionExpressionParser.AttributeTypePredicateContext ctx) {
289279
Object expectedType = parseValue(ctx.value());
290-
return new TypeOperation(parsePath(ctx.path()), expectedType == null ? null : String.valueOf(expectedType));
280+
return new TypeOperation(parseFieldName(ctx.path().getText()), expectedType == null ? null : String.valueOf(expectedType));
291281
}
292282

293283
/** {@inheritDoc} */
294284
@Override
295285
public QueryOperation visitBeginsWithPredicate(DynamoDbConditionExpressionParser.BeginsWithPredicateContext ctx) {
296-
return new BeginsWithOperation(parsePath(ctx.path()), parseValue(ctx.value()));
286+
return new BeginsWithOperation(parseFieldName(ctx.path().getText()), parseValue(ctx.value()));
297287
}
298288

299289
/** {@inheritDoc} */
300290
@Override
301291
public QueryOperation visitContainsPredicate(DynamoDbConditionExpressionParser.ContainsPredicateContext ctx) {
302-
return new ContainsOperation(parsePath(ctx.path()), parseValue(ctx.value()));
292+
return new ContainsOperation(parseFieldName(ctx.path().getText()), parseValue(ctx.value()));
303293
}
304294

305295
/** {@inheritDoc} */
306296
@Override
307297
public QueryOperation visitSizePredicate(DynamoDbConditionExpressionParser.SizePredicateContext ctx) {
308-
String field = parsePath(ctx.path());
298+
String field = parseFieldName(ctx.path().getText());
309299
DynamoDbComparisonType comparator = DynamoDbComparisonType.fromToken(ctx.comparator().getText());
310300
Object expectedValue = parseValue(ctx.value());
311301
return new SizeOperation(field, comparator, expectedValue);
@@ -314,7 +304,7 @@ public QueryOperation visitSizePredicate(DynamoDbConditionExpressionParser.SizeP
314304
/** {@inheritDoc} */
315305
@Override
316306
public QueryOperation visitBetweenPredicate(DynamoDbConditionExpressionParser.BetweenPredicateContext ctx) {
317-
String field = parsePath(ctx.path());
307+
String field = parseFieldName(ctx.path().getText());
318308
Object lower = parseValue(ctx.value(0));
319309
Object upper = parseValue(ctx.value(1));
320310
return new BetweenOperation(field, lower, upper);
@@ -327,13 +317,13 @@ public QueryOperation visitInPredicate(DynamoDbConditionExpressionParser.InPredi
327317
for (DynamoDbConditionExpressionParser.ValueContext valueContext : ctx.value()) {
328318
values.add(parseValue(valueContext));
329319
}
330-
return new InOperation<>(parsePath(ctx.path()), values);
320+
return new InOperation<>(parseFieldName(ctx.path().getText()), values);
331321
}
332322

333323
/** {@inheritDoc} */
334324
@Override
335325
public QueryOperation visitComparisonPredicate(DynamoDbConditionExpressionParser.ComparisonPredicateContext ctx) {
336-
String field = parsePath(ctx.path());
326+
String field = parseFieldName(ctx.path().getText());
337327
DynamoDbComparisonType comparator = DynamoDbComparisonType.fromToken(ctx.comparator().getText());
338328
Object value = parseValue(ctx.value());
339329
return comparator.toOperation(field, value);

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/operations/BeginsWithOperation.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,24 @@ public class BeginsWithOperation extends QueryOperation {
1111
/**
1212
* Creates a begins-with operation.
1313
*
14-
* @param fieldName attribute path
14+
* @param fieldName field name coming from DynamoDB expression/condition
1515
* @param prefix expected prefix
1616
*/
1717
public BeginsWithOperation(String fieldName, Object prefix) {
1818
this.fieldName = fieldName;
1919
this.prefix = prefix;
2020
}
2121

22+
/**
23+
* @return field name coming from DynamoDB expression/condition
24+
*/
2225
public String getFieldName() {
2326
return fieldName;
2427
}
2528

29+
/**
30+
* @return expected prefix
31+
*/
2632
public Object getPrefix() {
2733
return prefix;
2834
}

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/operations/BetweenOperation.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class BetweenOperation extends QueryOperation {
1212
/**
1313
* Creates a BETWEEN operation.
1414
*
15-
* @param fieldName attribute path
15+
* @param fieldName field name coming from DynamoDB expression/condition
1616
* @param lowerBound lower bound value
1717
* @param upperBound upper bound value
1818
*/
@@ -22,14 +22,23 @@ public BetweenOperation(String fieldName, Object lowerBound, Object upperBound)
2222
this.upperBound = upperBound;
2323
}
2424

25+
/**
26+
* @return field name coming from DynamoDB expression/condition
27+
*/
2528
public String getFieldName() {
2629
return fieldName;
2730
}
2831

32+
/**
33+
* @return lower bound value
34+
*/
2935
public Object getLowerBound() {
3036
return lowerBound;
3137
}
3238

39+
/**
40+
* @return upper bound value
41+
*/
3342
public Object getUpperBound() {
3443
return upperBound;
3544
}

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/operations/ContainsOperation.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,24 @@ public class ContainsOperation extends QueryOperation {
1111
/**
1212
* Creates a contains operation.
1313
*
14-
* @param fieldName attribute path
14+
* @param fieldName field name coming from DynamoDB expression/condition
1515
* @param expectedValue expected contained value
1616
*/
1717
public ContainsOperation(String fieldName, Object expectedValue) {
1818
this.fieldName = fieldName;
1919
this.expectedValue = expectedValue;
2020
}
2121

22+
/**
23+
* @return field name coming from DynamoDB expression/condition
24+
*/
2225
public String getFieldName() {
2326
return fieldName;
2427
}
2528

29+
/**
30+
* @return expected contained value
31+
*/
2632
public Object getExpectedValue() {
2733
return expectedValue;
2834
}

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/operations/ExistsOperation.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@ public class ExistsOperation extends QueryOperation {
1313
/**
1414
* Creates an existence operation.
1515
*
16-
* @param fieldName attribute path
16+
* @param fieldName field name coming from DynamoDB expression/condition
1717
* @param exists {@code true} for exists, {@code false} for not-exists
1818
*/
1919
public ExistsOperation(String fieldName, boolean exists) {
2020
this.fieldName = fieldName;
2121
this.exists = exists;
2222
}
2323

24+
/**
25+
* @return field name coming from DynamoDB expression/condition
26+
*/
2427
public String getFieldName() {
2528
return fieldName;
2629
}
2730

31+
/**
32+
* @return {@code true} when existence is required, {@code false} otherwise
33+
*/
2834
public boolean isExists() {
2935
return exists;
3036
}

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/operations/InOperation.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,24 @@ public class InOperation<V> extends QueryOperation {
1515
/**
1616
* Creates an IN operation.
1717
*
18-
* @param fieldName attribute path
18+
* @param fieldName field name coming from DynamoDB expression/condition
1919
* @param values candidate values
2020
*/
2121
public InOperation(String fieldName, List<V> values) {
2222
this.fieldName = fieldName;
2323
this.values = values;
2424
}
2525

26+
/**
27+
* @return field name coming from DynamoDB expression/condition
28+
*/
2629
public String getFieldName() {
2730
return fieldName;
2831
}
2932

33+
/**
34+
* @return candidate values
35+
*/
3036
public List<V> getValues() {
3137
return values;
3238
}

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/operations/NotOperation.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public NotOperation(QueryOperation condition) {
1616
this.condition = condition;
1717
}
1818

19+
/**
20+
* @return negated condition
21+
*/
1922
public QueryOperation getCondition() {
2023
return condition;
2124
}

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/operations/SizeOperation.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class SizeOperation extends QueryOperation {
1414
/**
1515
* Creates a size operation.
1616
*
17-
* @param fieldName attribute path
17+
* @param fieldName field name coming from DynamoDB expression/condition
1818
* @param comparator comparison operator
1919
* @param expectedValue expected value
2020
*/
@@ -24,14 +24,23 @@ public SizeOperation(String fieldName, DynamoDbComparisonType comparator, Object
2424
this.expectedValue = expectedValue;
2525
}
2626

27+
/**
28+
* @return field name coming from DynamoDB expression/condition
29+
*/
2730
public String getFieldName() {
2831
return fieldName;
2932
}
3033

34+
/**
35+
* @return comparison operator
36+
*/
3137
public DynamoDbComparisonType getComparator() {
3238
return comparator;
3339
}
3440

41+
/**
42+
* @return expected value
43+
*/
3544
public Object getExpectedValue() {
3645
return expectedValue;
3746
}

client-java/controller/src/main/java/org/evomaster/client/java/controller/dynamodb/operations/TypeOperation.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,24 @@ public class TypeOperation extends QueryOperation {
1111
/**
1212
* Creates a type operation.
1313
*
14-
* @param fieldName attribute path
14+
* @param fieldName field name coming from DynamoDB expression/condition
1515
* @param expectedType expected DynamoDB type token
1616
*/
1717
public TypeOperation(String fieldName, String expectedType) {
1818
this.fieldName = fieldName;
1919
this.expectedType = expectedType;
2020
}
2121

22+
/**
23+
* @return field name coming from DynamoDB expression/condition
24+
*/
2225
public String getFieldName() {
2326
return fieldName;
2427
}
2528

29+
/**
30+
* @return expected DynamoDB type token
31+
*/
2632
public String getExpectedType() {
2733
return expectedType;
2834
}

0 commit comments

Comments
 (0)