Class QueryApiMethodParser

java.lang.Object
org.evomaster.client.java.controller.dynamodb.parsers.QueryApiMethodParser
All Implemented Interfaces:
DynamoDbApiMethodParser

public class QueryApiMethodParser extends Object
Parser for DynamoDB Query requests.
  • Field Details

  • Constructor Details

    • QueryApiMethodParser

      public QueryApiMethodParser()
  • Method Details

    • apiMethodName

      public org.evomaster.client.java.instrumentation.DynamoDbOperationNames apiMethodName()
      Returns the DynamoDB API method handled by this parser.
      Returns:
      API method identifier
    • parseRequest

      public Map<String,ParsedDynamoDbRequest> parseRequest(Object ddbRequest)
      Parses one request object into table-specific request expressions.
      Parameters:
      ddbRequest - DynamoDB request object
      Returns:
      a map of parsed requests by table name
    • parseExpression

      protected QueryOperation parseExpression(String expression, Map<String,String> expressionAttributeNames, Map<String,Object> expressionAttributeValues)
      Parses a DynamoDB expression string into a query operation.
      Parameters:
      expression - expression string
      expressionAttributeNames - name placeholders map
      expressionAttributeValues - value placeholders map
      Returns:
      parsed operation, or null
    • parseKeyCondition

      protected QueryOperation parseKeyCondition(Object ddbRequest)
      Parses key equality conditions from DynamoDB request key fields.
      Parameters:
      ddbRequest - DynamoDB request object
      Returns:
      parsed key condition operation
    • buildEqualsFromMap

      protected QueryOperation buildEqualsFromMap(Map<String,Object> values)
      Builds equality operations from a field/value map.
      Parameters:
      values - field/value map
      Returns:
      combined equality operation, or null
    • combineWithAnd

      protected QueryOperation combineWithAnd(List<QueryOperation> conditions)
      Combines a list of operations with AND semantics.
      Parameters:
      conditions - conditions to combine
      Returns:
      combined operation
    • combine

      protected QueryOperation combine(List<QueryOperation> conditions, Function<List<QueryOperation>,QueryOperation> compositeBuilder)
      Combines a list of operations with a provided composite builder, skipping null entries.
      Parameters:
      conditions - operations to combine
      compositeBuilder - builder for composite operation
      Returns:
      combined operation, one operation, or null
    • readNameMap

      protected Map<String,String> readNameMap(Object ddbRequest)
      Reads and normalizes expression attribute names from DynamoDB request object.
      Parameters:
      ddbRequest - DynamoDB request object
      Returns:
      normalized name map
    • readValueMap

      protected Map<String,Object> readValueMap(Object ddbRequest)
      Reads and converts expression attribute values from DynamoDB request object.
      Parameters:
      ddbRequest - DynamoDB request object
      Returns:
      normalized value map
    • readString

      protected String readString(Object ddbRequest, String methodName)
      Reads a string-like value from a DDB request object via reflection.
      Parameters:
      ddbRequest - DynamoDB request object
      methodName - accessor method name
      Returns:
      string value, or null
    • readValidTableName

      protected String readValidTableName(Object ddbRequest)
      Reads and validates the table name from the request.
      Parameters:
      ddbRequest - DynamoDB request object
      Returns:
      table name, or null if blank/absent
    • buildSingleTableRequestMap

      protected Map<String,ParsedDynamoDbRequest> buildSingleTableRequestMap(String tableName, QueryOperation keyCondition, QueryOperation filterExpression)
      Builds a singleton result map for one table/request pair.
      Parameters:
      tableName - table name
      keyCondition - parsed key condition
      filterExpression - parsed filter or condition expression
      Returns:
      singleton map or empty map when invalid