Package org.ldaptive.beans.reflect
Class SingleValueReflectionTranscoder<T>
java.lang.Object
org.ldaptive.beans.reflect.SingleValueReflectionTranscoder<T>
- Type Parameters:
T
- type of object to transcode
- All Implemented Interfaces:
ReflectionTranscoder
Reflection transcoder which expects to operate on collections containing a single value.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSingleValueReflectionTranscoder
(ValueTranscoder<T> transcoder) Creates a new single value reflection transcoder. -
Method Summary
Modifier and TypeMethodDescriptiondecodeBinaryValues
(Collection<byte[]> values) Decodes the supplied values into an object.decodeStringValues
(Collection<String> values) Decodes the supplied values into an object.Collection
<byte[]> encodeBinaryValues
(Object value) Encodes the supplied value into one or more byte arrays for use in an attribute.encodeStringValues
(Object value) Encodes the supplied value into one or more strings for use in an attribute.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
Returns whether this transcoder can convert object of the supplied type.toString()
-
Field Details
-
valueTranscoder
Underlying value transcoder.
-
-
Constructor Details
-
SingleValueReflectionTranscoder
Creates a new single value reflection transcoder.- Parameters:
transcoder
- for a single value
-
-
Method Details
-
newInstance
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
Description copied from interface:ReflectionTranscoder
Decodes the supplied values into an object.- Specified by:
decodeStringValues
in interfaceReflectionTranscoder
- Parameters:
values
- to decode- Returns:
- object initialized with the values
-
decodeBinaryValues
Description copied from interface:ReflectionTranscoder
Decodes the supplied values into an object.- Specified by:
decodeBinaryValues
in interfaceReflectionTranscoder
- Parameters:
values
- to decode- Returns:
- object initialized with the values
-
encodeStringValues
Description copied from interface:ReflectionTranscoder
Encodes the supplied value into one or more strings for use in an attribute.- Specified by:
encodeStringValues
in interfaceReflectionTranscoder
- Parameters:
value
- containing data to encode as strings- Returns:
- string attribute values
-
encodeBinaryValues
Description copied from interface:ReflectionTranscoder
Encodes the supplied value into one or more byte arrays for use in an attribute.- Specified by:
encodeBinaryValues
in interfaceReflectionTranscoder
- Parameters:
value
- containing data to encode as byte arrays- Returns:
- binary attribute values
-
getType
Description copied from interface:ReflectionTranscoder
Returns the type produced by this transcoder.- Specified by:
getType
in interfaceReflectionTranscoder
- Returns:
- type produced by this transcoder
-
supports
Description copied from interface:ReflectionTranscoder
Returns whether this transcoder can convert object of the supplied type.- Specified by:
supports
in interfaceReflectionTranscoder
- Parameters:
type
- of object- Returns:
- whether the supplied type can be converted
-
toString
-