public class EnumValueCoder extends Object implements ValueCoder
Constructor and Description |
---|
EnumValueCoder() |
Modifier and Type | Method and Description |
---|---|
Object |
get(Value value,
Class clazz,
CoderContext context)
Creates an instance of the supplied class, populates its state by
decoding the supplied
Value , and returns it. |
void |
put(Value value,
Object object,
CoderContext context)
Encodes the supplied
Object into the supplied
Value . |
public void put(Value value, Object object, CoderContext context) throws ConversionException
Encodes the supplied Object
into the supplied
Value
. This method will be called only if this
ValueCoder
has been registered with the current
CoderManager
to encode objects having the class of the supplied
object.
Upon completion of this method, the backing byte array of the
Value
and its size should be updated to reflect the appended
key segment. Use the methods Value.getEncodedBytes()
,
Value.getEncodedSize()
and Value.setEncodedSize(int)
to
manipulate the byte array directly. More commonly, the implementation of
this method will simply call the appropriate put
methods to
write the interior field values into the Value
object.
put
in interface ValueCoder
value
- The Value
to which the interior data of the
supplied Object
should be encodedobject
- The object value to encode. This parameter will never be
null
because Persistit encodes nulls with a
built-in encoding.context
- An arbitrary object that can optionally be supplied by the
application to convey an application-specific context for the
operation. (See CoderContext
.) The default value is
null
.ConversionException
public Object get(Value value, Class clazz, CoderContext context) throws ConversionException
Creates an instance of the supplied class, populates its state by
decoding the supplied Value
, and returns it. This method
will be called only if this ValueCoder
has been registered
with the current CoderManager
to encode objects having supplied
Class
value. Persistit will never call this method to decode
a value that was null
when written because null values are
handled by built-in encoding logic.
get
in interface ValueCoder
value
- The Value
from which interior fields of the
object are to be retrievedclazz
- The class of the object to be returned.context
- An arbitrary object that can optionally be supplied by the
application to convey an application-specific context for the
operation. (See CoderContext
.) The default value is
null
.Object
having the same class as the suppled
clazz
parameter.ConversionException
Copyright © 2025 Open Identity Platform Community. All rights reserved.