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 Details

  • Constructor Details

    • AbstractNumericOperandParser

      public AbstractNumericOperandParser()
  • Method Details

    • 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 class AbstractOperandParser<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 class AbstractOperandParser<NumericOperand>
      Parameters:
      operand - operand to be serialized
      length - value of the 'length' field
      endOfList - if this operand is at the end of the list
      buffer - 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 serialized
      nlriByteBuf - 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 class AbstractOperandParser<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 class AbstractOperandParser<NumericOperand>
      Parameters:
      operand - operand
      isFirst - true if this operand is the first in list of operands
      Returns:
      String representation of the operand
    • toString

      protected abstract <T extends N> String toString(List<T> list)