Class DefaultReflectionTranscoder

  • All Implemented Interfaces:
    ReflectionTranscoder

    public class DefaultReflectionTranscoder
    extends Object
    implements ReflectionTranscoder
    Default implementation of a reflection transcoder. Determines the correct underlying reflection transcoder by inspecting the class type characteristics.
    • Constructor Detail

      • DefaultReflectionTranscoder

        public DefaultReflectionTranscoder​(Type type)
        Creates a new default reflection transcoder.
        Parameters:
        type - of object to transcode
      • DefaultReflectionTranscoder

        public DefaultReflectionTranscoder​(Type type,
                                           ValueTranscoder<?> transcoder)
        Creates a new default reflection transcoder.
        Parameters:
        type - of object to transcode
        transcoder - custom transcoder for this type
    • Method Detail

      • getDefaultSingleValueTranscoders

        protected Set<SingleValueReflectionTranscoder<?>> getDefaultSingleValueTranscoders()
        Initializes the set of default single value transcoders.
        Returns:
        single value transcoders
      • getSingleValueReflectionTranscoder

        protected SingleValueReflectionTranscoder getSingleValueReflectionTranscoder​(Class<?> type)
        Returns the appropriate single value encoder for the supplied type.
        Parameters:
        type - to provide a single value encoder for
        Returns:
        single value reflection transcoder
      • getCollectionEncoder

        protected ReflectionTranscoder getCollectionEncoder​(Class<?> type,
                                                            Type genericType)
        Returns the appropriate collection encoder for the supplied type.
        Parameters:
        type - to provide a collection encoder for
        genericType - of the collection
        Returns:
        reflection transcoder for a collection
      • encodeBinaryValues

        public Collection<byte[]> encodeBinaryValues​(Object values)
        Description copied from interface: ReflectionTranscoder
        Encodes the supplied value into one or more byte arrays for use in an attribute.
        Specified by:
        encodeBinaryValues in interface ReflectionTranscoder
        Parameters:
        values - containing data to encode as byte arrays
        Returns:
        binary attribute values
      • supports

        public boolean supports​(Class<?> type)
        Description copied from interface: ReflectionTranscoder
        Returns whether this transcoder can convert object of the supplied type.
        Specified by:
        supports in interface ReflectionTranscoder
        Parameters:
        type - of object
        Returns:
        whether the supplied type can be converted