Interface EncoderFactory

All Known Implementing Classes:
AbstractObjectEncoderFactory, AnnotationEncoderFactory, ItemSetEncoderFactory

public interface EncoderFactory
An interface defining a factory that provides an encoder and decoder for a particular class or set of classes. This factory is utilized by the encoding/decoding framework to extend it's functionality. A class that wishes to be serialized properly must define a factory for the class and register the factory.

NOTE: Implementations should extend AbstractObjectEncoderFactory factory rather than directly implementing EncoderFactory.

  • Method Details

    • isFactoryForType

      boolean isFactoryForType(TokenType type)
      Determine if this factory supports the given class type. A factory may support many types.
      Parameters:
      type - the type to check
      Returns:
      true if supported; false otherwise
    • newEncoder

      TokenEncoder newEncoder(TokenType type)
      Create a new encoder instance for the given type. The type is specified to allow a single factory to serve multiple types.
      Parameters:
      type - the type which is to be encoded
      Returns:
      a new encoder instance
    • newDecoder

      TokenDecoder newDecoder(TokenType type)
      Create a new decoder instance for the given type. The type is specified to allow a single factory to serve multiple types.
      Parameters:
      type - the type which is to be decoded
      Returns:
      a new decoder instance