Class PathOperandUtils

java.lang.Object
com.aerospike.dsl.util.PathOperandUtils

public class PathOperandUtils extends Object
  • Constructor Details

    • PathOperandUtils

      public PathOperandUtils()
  • Method Details

    • processValueType

      public static com.aerospike.client.exp.Exp.Type processValueType(AbstractPart lastPathPart, PathFunction pathFunction)
      Processes value type based on the last part of a path and a PathFunction. If the PathFunction's binary type is not null, it's used directly. Otherwise, it checks for list or map type designators, or finds the value type based on the last path part and function type.
      Parameters:
      lastPathPart - The last AbstractPart in the path
      pathFunction - The PathFunction associated with the path
      Returns:
      The determined Exp.Type for the value
    • processPathFunction

      public static PathFunction processPathFunction(BasePath basePath, AbstractPart lastPathPart, PathFunction pathFunction)
      Processes and potentially modifies a PathFunction based on the BasePath and the last AbstractPart in the path. This method applies default values for PathFunction if it's null, or adjusts its type (e.g., from COUNT to SIZE) based on the context of the path parts.
      Parameters:
      basePath - The BasePath containing the bin and CDT parts
      lastPathPart - The last AbstractPart in the path
      pathFunction - The PathFunction to be processed
      Returns:
      The processed PathFunction
    • processGet

      public static com.aerospike.client.exp.Exp processGet(BasePath basePath, AbstractPart lastPathPart, com.aerospike.client.exp.Exp.Type valueType, int cdtReturnType)
      Processes a "get" operation for a path, constructing the appropriate Exp based on the last path part's type. This method supports LIST_PART and MAP_PART types.
      Parameters:
      basePath - The BasePath of the expression
      lastPathPart - The last AbstractPart in the path, which determines the type of get operation
      valueType - The expected Exp.Type of the value being retrieved
      cdtReturnType - The CDT return type
      Returns:
      An Exp representing the "get" operation
      Throws:
      UnsupportedOperationException - If the path part type is not supported
    • getContextArray

      public static com.aerospike.client.cdt.CTX[] getContextArray(List<AbstractPart> parts, boolean includeLast)
      Constructs an array of CTX (context) objects from a list of AbstractPart objects. This is used to build the context for nested CDT operations.
      Parameters:
      parts - The list of AbstractPart objects representing path parts
      includeLast - A boolean indicating whether the last part should be included in the context array
      Returns:
      An array of CTX objects
    • processSize

      public static com.aerospike.client.exp.Exp processSize(BasePath basePath, AbstractPart lastPathPart, com.aerospike.client.exp.Exp.Type valueType, int cdtReturnType)
      Processes a "size" operation for a path, constructing the appropriate Exp based on the last path part's type. This method supports LIST_PART and MAP_PART types.
      Parameters:
      basePath - The BasePath of the expression
      lastPathPart - The last AbstractPart in the path, which determines the type of size operation
      valueType - The expected Exp.Type of the value whose size is being retrieved
      cdtReturnType - The CDT return type
      Returns:
      An Exp representing the "size" operation
      Throws:
      UnsupportedOperationException - If the path part type is not supported
    • updateWithCdtTypeDesignator

      public static void updateWithCdtTypeDesignator(BasePath basePath, PathFunction pathFunction)
      Updates the BasePath with a CDT (Collection Data Type) type designator if necessary. This is typically done for operations like list.count() or map.count() when no explicit designator (e.g., [] for List, {} for Map) is present, and the last CDT part is ambiguous.
      Parameters:
      basePath - The BasePath to be updated
      pathFunction - The PathFunction associated with the operation