Package com.aerospike.dsl.util
Class PathOperandUtils
java.lang.Object
com.aerospike.dsl.util.PathOperandUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.aerospike.client.cdt.CTX[]getContextArray(List<AbstractPart> parts, boolean includeLast) Constructs an array ofCTX(context) objects from a list ofAbstractPartobjects.static com.aerospike.client.exp.ExpprocessGet(BasePath basePath, AbstractPart lastPathPart, com.aerospike.client.exp.Exp.Type valueType, int cdtReturnType) Processes a "get" operation for a path, constructing the appropriateExpbased on the last path part's type.static PathFunctionprocessPathFunction(BasePath basePath, AbstractPart lastPathPart, PathFunction pathFunction) Processes and potentially modifies aPathFunctionbased on theBasePathand the lastAbstractPartin the path.static com.aerospike.client.exp.ExpprocessSize(BasePath basePath, AbstractPart lastPathPart, com.aerospike.client.exp.Exp.Type valueType, int cdtReturnType) Processes a "size" operation for a path, constructing the appropriateExpbased on the last path part's type.static com.aerospike.client.exp.Exp.TypeprocessValueType(AbstractPart lastPathPart, PathFunction pathFunction) Processes value type based on the last part of a path and aPathFunction.static voidupdateWithCdtTypeDesignator(BasePath basePath, PathFunction pathFunction) Updates theBasePathwith a CDT (Collection Data Type) type designator if necessary.
-
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 aPathFunction. If thePathFunction'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 lastAbstractPartin the pathpathFunction- ThePathFunctionassociated with the path- Returns:
- The determined
Exp.Typefor the value
-
processPathFunction
public static PathFunction processPathFunction(BasePath basePath, AbstractPart lastPathPart, PathFunction pathFunction) Processes and potentially modifies aPathFunctionbased on theBasePathand the lastAbstractPartin the path. This method applies default values forPathFunctionif it's null, or adjusts its type (e.g., from COUNT to SIZE) based on the context of the path parts.- Parameters:
basePath- TheBasePathcontaining the bin and CDT partslastPathPart- The lastAbstractPartin the pathpathFunction- ThePathFunctionto 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 appropriateExpbased on the last path part's type. This method supportsLIST_PARTandMAP_PARTtypes.- Parameters:
basePath- TheBasePathof the expressionlastPathPart- The lastAbstractPartin the path, which determines the type of get operationvalueType- The expectedExp.Typeof the value being retrievedcdtReturnType- The CDT return type- Returns:
- An
Exprepresenting 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 ofCTX(context) objects from a list ofAbstractPartobjects. This is used to build the context for nested CDT operations.- Parameters:
parts- The list ofAbstractPartobjects representing path partsincludeLast- A boolean indicating whether the last part should be included in the context array- Returns:
- An array of
CTXobjects
-
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 appropriateExpbased on the last path part's type. This method supportsLIST_PARTandMAP_PARTtypes.- Parameters:
basePath- TheBasePathof the expressionlastPathPart- The lastAbstractPartin the path, which determines the type of size operationvalueType- The expectedExp.Typeof the value whose size is being retrievedcdtReturnType- The CDT return type- Returns:
- An
Exprepresenting the "size" operation - Throws:
UnsupportedOperationException- If the path part type is not supported
-
updateWithCdtTypeDesignator
Updates theBasePathwith a CDT (Collection Data Type) type designator if necessary. This is typically done for operations likelist.count()ormap.count()when no explicit designator (e.g.,[]for List,{}for Map) is present, and the last CDT part is ambiguous.- Parameters:
basePath- TheBasePathto be updatedpathFunction- ThePathFunctionassociated with the operation
-