com.h3c.of.lib.match

## Class MatchFactory

- java.lang.Object
- - com.h3c.of.lib.AbstractFactory
  - - com.h3c.of.lib.match.MatchFactory

-     public class MatchFactory
      extends AbstractFactory

  Provides facilities for parsing, creating and encoding `Match` instances.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MutableMatch` | `createMatch(ProtocolVersion pv)` Creates a mutable match instance.
    `static void` | `encodeMatch(Match match, OfPacketWriter pkt)` Encodes a match, writing it into the supplied buffer.
    `static Match` | `parseMatch(OfPacketReader pkt, ProtocolVersion pv)` Parses a Match structure from the supplied buffer.
    `protected String` | `tag()` Returns an identifying tag for the match factory.

    - ### Methods inherited from class com.h3c.of.lib.AbstractFactory

      `mpe, mpe, mpe, mpe`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### tag

          protected String tag()

      Returns an identifying tag for the match factory.
      Specified by:
        `tag` in class `AbstractFactory`
      Returns:
        an identifying tag

    - #### parseMatch

          public static Match parseMatch(OfPacketReader pkt,
                         ProtocolVersion pv)
                                  throws MessageParseException

      Parses a Match structure from the supplied buffer. Note that this method causes the reader index of the underlying `PacketBuffer` to be advanced by the length of the structure (including the padding).
      Parameters:
        `pkt` - the data buffer
        `pv` - the protocol version
      Returns:
        a parsed match structure
      Throws:
        `MessageParseException` - if unable to parse the structure

    - #### createMatch

          public static MutableMatch createMatch(ProtocolVersion pv)

      Creates a mutable match instance.
      Parameters:
        `pv` - the protocol version
      Returns:
        a mutable match
      Throws:
        `VersionNotSupportedException` - if the version is not supported

    - #### encodeMatch

          public static void encodeMatch(Match match,
                         OfPacketWriter pkt)

      Encodes a match, writing it into the supplied buffer. Note that this method causes the writer index of the underlying `PacketBuffer` to be advanced by the length of the match.
      Parameters:
        `match` - the match
        `pkt` - the buffer into which the match is to be written

Copyright © 2014. All Rights Reserved.