Class TokenEncodings


  • public final class TokenEncodings
    extends Object
    A factory for obtaining standard encoders/decoders for token values.
    See Also:
    TokenEncoder, TokenDecoder
    • Method Detail

      • getDefaultInstance

        public static TokenEncodings getDefaultInstance()
        Returns the default instance of TokenEncodings, configured according to service lookup for the service EncoderFactory.
        Returns:
        the default instance of TokenEncodings
      • newInstance

        public TokenEncodings newInstance​(EncoderFactory factory)
        Returns a new instance of TokenEncodings, configured with the encoder factories of this instance, plus the given factory. The additional factory will be added at the beginning of the list so as to take precedence over all other factories.
        Parameters:
        factory - The additional factory.
        Returns:
        a new instance of TokenEncodings, configured with the given factory.
      • allocateDecoder

        public TokenDecoder allocateDecoder​(TokenType type,
                                            TokenOrder... ordering)
        Creates a default decoder appropriate for the given type. The resulting decoder can decode encodings made by the default encoder for the type.
        Parameters:
        type - the type of the data to be decoded
        ordering - ordering information
        Returns:
        a decoder for the type
      • allocateEncoder

        public TokenEncoder allocateEncoder​(TokenType type,
                                            TokenOrder... ordering)
        Creates a default encoder appropriate for the given type.
        Parameters:
        type - the type of the data to be decoded
        ordering - ordering information
        Returns:
        a default encoder for the type
      • allocateRecordDecoder

        public TokenDecoder allocateRecordDecoder​(RecordTokenType type,
                                                  ComparableTokenDecoder[] comparableDecoders,
                                                  TokenDecoder[] fieldDecoders)
        Creates a record decoder from a list of field decoders for the fields in the record.
        Parameters:
        type - the record type to decode
        comparableDecoders - array of field decoders for ordering key fields in the record.
        fieldDecoders - array of field decoders for the non-ordering key fields in the record.
        Returns:
        the record decoder
      • allocateRecordEncoder

        public TokenEncoder allocateRecordEncoder​(RecordTokenType type,
                                                  ComparableTokenEncoder[] comparableEncoders,
                                                  TokenEncoder[] fieldEncoders)
        Creates a record encoder from a list of field encoders for the fields in the record.
        Parameters:
        type - the record type to encode
        comparableEncoders - array of field encoders for ordering key fields in the record.
        fieldEncoders - array of field encoders for the non-ordering key fields in the record.
        Returns:
        the record encoder