Package io.lettuce.core.dynamic.segment
Class CommandSegment
- java.lang.Object
-
- io.lettuce.core.dynamic.segment.CommandSegment
-
public abstract class CommandSegment extends Object
Value object representing a segment within a Redis Command.A command segment is an ASCII string denoting a command, a named or an index-parameter reference.
- Since:
- 5.0
- Author:
- Mark Paluch
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CommandSegment.ArgumentContribution
-
Constructor Summary
Constructors Constructor Description CommandSegment()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
asString()
abstract boolean
canConsume(Parameter parameter)
Check whether this segment can consume theParameter
by applying parameter substitution.static CommandSegment
constant(String content)
Create a constantCommandSegment
.abstract CommandSegment.ArgumentContribution
contribute(MethodParametersAccessor parametersAccessor)
static CommandSegment
indexedParameter(int index)
static CommandSegment
namedParameter(String name)
Create a named parameter referenceCommandSegment
.String
toString()
-
-
-
Method Detail
-
constant
public static CommandSegment constant(String content)
Create a constantCommandSegment
.- Parameters:
content
- must not be empty ornull
.- Returns:
- the
CommandSegment
.
-
namedParameter
public static CommandSegment namedParameter(String name)
Create a named parameter referenceCommandSegment
.- Parameters:
name
- must not be empty ornull
.- Returns:
-
indexedParameter
public static CommandSegment indexedParameter(int index)
-
asString
public abstract String asString()
- Returns:
- the command segment in its
representation
-
canConsume
public abstract boolean canConsume(Parameter parameter)
Check whether this segment can consume theParameter
by applying parameter substitution.- Parameters:
parameter
-- Returns:
- Since:
- 5.1.3
-
contribute
public abstract CommandSegment.ArgumentContribution contribute(MethodParametersAccessor parametersAccessor)
- Parameters:
parametersAccessor
-- Returns:
-
-