Class AbstractNumericOperandParser<N>
- java.lang.Object
-
- org.opendaylight.protocol.bgp.flowspec.handlers.AbstractOperandParser<NumericOperand>
-
- org.opendaylight.protocol.bgp.flowspec.handlers.AbstractNumericOperandParser<N>
-
- Type Parameters:
N
- numeric operand type
- Direct Known Subclasses:
NumericOneByteOperandParser
,NumericTwoByteOperandParser
public abstract class AbstractNumericOperandParser<N> extends AbstractOperandParser<NumericOperand>
Common parent class for numeric operands.
-
-
Field Summary
Fields Modifier and Type Field Description static String
EQUALS_VALUE
static String
GREATER_THAN_VALUE
static String
LESS_THAN_VALUE
-
Fields inherited from class org.opendaylight.protocol.bgp.flowspec.handlers.AbstractOperandParser
AND_BIT, AND_BIT_VALUE, END_OF_LIST, END_OF_LIST_VALUE, LENGTH_SHIFT, OPERAND_LENGTH
-
-
Constructor Summary
Constructors Constructor Description AbstractNumericOperandParser()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description NumericOperand
create(Set<String> operandValues)
Creates operand from a set of operand values.NumericOperand
parse(byte operand)
Parses operand from byte value.protected abstract <T extends N>
voidserialize(List<T> list, io.netty.buffer.ByteBuf nlriByteBuf)
Serializes specific numeric operand type depending on the length field value.void
serialize(NumericOperand operand, int length, boolean endOfList, io.netty.buffer.ByteBuf buffer)
Serializes operand to bytes.protected abstract <T extends N>
StringtoString(List<T> list)
String
toString(NumericOperand operand, boolean isFirst)
Creates a string representation of the operand.-
Methods inherited from class org.opendaylight.protocol.bgp.flowspec.handlers.AbstractOperandParser
parseLength
-
-
-
-
Field Detail
-
EQUALS_VALUE
public static final String EQUALS_VALUE
- See Also:
- Constant Field Values
-
GREATER_THAN_VALUE
public static final String GREATER_THAN_VALUE
- See Also:
- Constant Field Values
-
LESS_THAN_VALUE
public static final String LESS_THAN_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public final NumericOperand create(Set<String> operandValues)
Description copied from class:AbstractOperandParser
Creates operand from a set of operand values.- Specified by:
create
in classAbstractOperandParser<NumericOperand>
- Parameters:
operandValues
- set of operand values- Returns:
- specific type of operand
-
serialize
public final void serialize(NumericOperand operand, int length, boolean endOfList, io.netty.buffer.ByteBuf buffer)
Description copied from class:AbstractOperandParser
Serializes operand to bytes.- Specified by:
serialize
in classAbstractOperandParser<NumericOperand>
- Parameters:
operand
- operand to be serializedlength
- value of the 'length' fieldendOfList
- if this operand is at the end of the listbuffer
- where the operand will be serialized to
-
serialize
protected abstract <T extends N> void serialize(List<T> list, io.netty.buffer.ByteBuf nlriByteBuf)
Serializes specific numeric operand type depending on the length field value.- Parameters:
list
- of operands to be serializednlriByteBuf
- where the operands will be serialized
-
parse
public final NumericOperand parse(byte operand)
Description copied from class:AbstractOperandParser
Parses operand from byte value.- Specified by:
parse
in classAbstractOperandParser<NumericOperand>
- Parameters:
operand
- byte representation of an operand- Returns:
- operand object
-
toString
public String toString(NumericOperand operand, boolean isFirst)
Description copied from class:AbstractOperandParser
Creates a string representation of the operand. E.g. : 'and does not match'- Specified by:
toString
in classAbstractOperandParser<NumericOperand>
- Parameters:
operand
- operandisFirst
- true if this operand is the first in list of operands- Returns:
- String representation of the operand
-
-