Class GeometryShapeConverter<T>

  • Type Parameters:
    T - the type
    All Implemented Interfaces:
    org.bson.codecs.Codec<T>, org.bson.codecs.Decoder<T>, org.bson.codecs.Encoder<T>

    public class GeometryShapeConverter<T>
    extends Object
    implements org.bson.codecs.Codec<T>
    Converter that understands most Geometry instances are effectively just lists of either other geometry objects or double coordinates. Recursively encodes and decodes Geometry objects, but needs to be instantiated with a List of GeometryFactory instances that represented the hierarchy of Geometries that make up the required Geometry object.

    Overridden by subclasses to define exact behaviour for specific Geometry concrete classes.

    • Constructor Detail

      • GeometryShapeConverter

        public GeometryShapeConverter()
    • Method Detail

      • decode

        public T decode​(org.bson.BsonReader reader,
                        org.bson.codecs.DecoderContext decoderContext)
        Description copied from interface: org.bson.codecs.Decoder
        Decodes a BSON value from the given reader into an instance of the type parameter T.
        Specified by:
        decode in interface org.bson.codecs.Decoder<T>
        Parameters:
        reader - the BSON reader
        decoderContext - the decoder context
        Returns:
        an instance of the type parameter T.
      • encode

        public void encode​(org.bson.BsonWriter writer,
                           T value,
                           org.bson.codecs.EncoderContext encoderContext)
        Description copied from interface: org.bson.codecs.Encoder
        Encode an instance of the type parameter T into a BSON value.
        Specified by:
        encode in interface org.bson.codecs.Encoder<T>
        Parameters:
        writer - the BSON writer to encode into
        value - the value to encode
        encoderContext - the encoder context
      • getEncoderClass

        public Class<T> getEncoderClass()
        Description copied from interface: org.bson.codecs.Encoder
        Returns the Class instance that this encodes. This is necessary because Java does not reify generic types.
        Specified by:
        getEncoderClass in interface org.bson.codecs.Encoder<T>
        Returns:
        the Class instance that this encodes.