Class AbstractOperandParser<T>
java.lang.Object
org.opendaylight.protocol.bgp.flowspec.handlers.AbstractOperandParser<T>
- Type Parameters:
T
- operand Type
- Direct Known Subclasses:
AbstractNumericOperandParser
,BitmaskOperandParser
Top-level abstract class for all defined operands.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
Creates operand from a set of operand values.protected abstract T
parse
(byte op) Parses operand from byte value.static short
parseLength
(byte op) protected abstract void
Serializes operand to bytes.protected abstract String
Creates a string representation of the operand.
-
Field Details
-
AND_BIT_VALUE
- See Also:
-
END_OF_LIST_VALUE
- See Also:
-
OPERAND_LENGTH
protected static final int OPERAND_LENGTH- See Also:
-
END_OF_LIST
protected static final int END_OF_LIST- See Also:
-
AND_BIT
protected static final int AND_BIT- See Also:
-
LENGTH_SHIFT
protected static final int LENGTH_SHIFT- See Also:
-
-
Constructor Details
-
AbstractOperandParser
public AbstractOperandParser()
-
-
Method Details
-
parseLength
public static short parseLength(byte op) -
create
Creates operand from a set of operand values.- Parameters:
opValues
- set of operand values- Returns:
- specific type of operand
-
serialize
protected abstract void serialize(T op, int length, boolean endOfList, io.netty.buffer.ByteBuf buffer) Serializes operand to bytes.- Parameters:
op
- 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
-
parse
Parses operand from byte value.- Parameters:
op
- byte representation of an operand- Returns:
- operand object
-
toString
Creates a string representation of the operand. E.g. : 'and does not match'- Parameters:
op
- operandisFirst
- true if this operand is the first in list of operands- Returns:
- String representation of the operand
-