Class SingleValueReflectionTranscoder<T>

  • Type Parameters:
    T - type of object to transcode
    All Implemented Interfaces:
    ReflectionTranscoder

    public class SingleValueReflectionTranscoder<T>
    extends java.lang.Object
    implements ReflectionTranscoder
    Reflection transcoder which expects to operate on collections containing a single value.
    Author:
    Middleware Services
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object decodeBinaryValues​(java.util.Collection<byte[]> values)
      Decodes the supplied values into an object.
      java.lang.Object decodeStringValues​(java.util.Collection<java.lang.String> values)
      Decodes the supplied values into an object.
      java.util.Collection<byte[]> encodeBinaryValues​(java.lang.Object value)
      Encodes the supplied value into one or more byte arrays for use in an attribute.
      java.util.Collection<java.lang.String> encodeStringValues​(java.lang.Object value)
      Encodes the supplied value into one or more strings for use in an attribute.
      java.lang.Class<?> getType()
      Returns the type produced by this transcoder.
      static <T> SingleValueReflectionTranscoder<T> newInstance​(ValueTranscoder<T> transcoder)
      Creates a new single value reflection transcoder.
      boolean supports​(java.lang.Class<?> type)
      Returns whether this transcoder can convert object of the supplied type.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SingleValueReflectionTranscoder

        public SingleValueReflectionTranscoder​(ValueTranscoder<T> transcoder)
        Creates a new single value reflection transcoder.
        Parameters:
        transcoder - for a single value
    • Method Detail

      • newInstance

        public static <T> SingleValueReflectionTranscoder<T> newInstance​(ValueTranscoder<T> transcoder)
        Creates a new single value reflection transcoder. Useful when the type of the value transcoder is unknown.
        Type Parameters:
        T - type to transcode
        Parameters:
        transcoder - for a single value
        Returns:
        single value reflection transcoder
      • decodeStringValues

        public java.lang.Object decodeStringValues​(java.util.Collection<java.lang.String> values)
        Description copied from interface: ReflectionTranscoder
        Decodes the supplied values into an object.
        Specified by:
        decodeStringValues in interface ReflectionTranscoder
        Parameters:
        values - to decode
        Returns:
        object initialized with the values
      • decodeBinaryValues

        public java.lang.Object decodeBinaryValues​(java.util.Collection<byte[]> values)
        Description copied from interface: ReflectionTranscoder
        Decodes the supplied values into an object.
        Specified by:
        decodeBinaryValues in interface ReflectionTranscoder
        Parameters:
        values - to decode
        Returns:
        object initialized with the values
      • encodeStringValues

        public java.util.Collection<java.lang.String> encodeStringValues​(java.lang.Object value)
        Description copied from interface: ReflectionTranscoder
        Encodes the supplied value into one or more strings for use in an attribute.
        Specified by:
        encodeStringValues in interface ReflectionTranscoder
        Parameters:
        value - containing data to encode as strings
        Returns:
        string attribute values
      • encodeBinaryValues

        public java.util.Collection<byte[]> encodeBinaryValues​(java.lang.Object value)
        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:
        value - containing data to encode as byte arrays
        Returns:
        binary attribute values
      • getType

        public java.lang.Class<?> getType()
        Description copied from interface: ReflectionTranscoder
        Returns the type produced by this transcoder.
        Specified by:
        getType in interface ReflectionTranscoder
        Returns:
        type produced by this transcoder
      • supports

        public boolean supports​(java.lang.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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object