Interface CommandCodec<T>

Type Parameters:
T - The type of encoded command.
All Known Implementing Classes:
AbstractHttpCommandCodec, W3CHttpCommandCodec

public interface CommandCodec<T>
Converts Command objects to and from another representation.
  • Method Details

    • isSupported

      boolean isSupported(String commandName)
      Returns:
      Whether this CommandCodec supports the given command name.
    • encode

      T encode(Command command)
      Encodes a command.
      Parameters:
      command - the command to encode.
      Returns:
      the encoded command.
      Throws:
      UnsupportedCommandException - If the command is not supported by this codec.
    • decode

      Command decode(T encodedCommand)
      Decodes a command.
      Parameters:
      encodedCommand - the command to decode.
      Returns:
      the decoded command.
      Throws:
      UnsupportedCommandException - If the command is not supported by this codec.
    • defineCommand

      void defineCommand(String name, HttpMethod method, String pathPattern)
      Enhance this command codec with additional commands.
    • alias

      void alias(String commandName, String isAnAliasFor)
      Allow commands to have aliases.
      Parameters:
      commandName - The command being added.
      isAnAliasFor - The command name that this is an alias for.