T - type that this BeanDescriptor can serialize and deserialize.public class BeanDescriptor<T> extends Object implements Converter<T>
Genson genson = new Genson();
BeanDescriptorProvider provider = genson.getBeanDescriptorProvider();
BeanDescriptor<MyClass> descriptor = provider.provide(MyClass.class, genson);
MyClass existingInstance = descriptor.deserialize(existingInstance, new JsonReader("{}"),
new Context(genson));
BeanDescriptorProvider| Constructor and Description |
|---|
BeanDescriptor(Class<T> forClass,
Class<?> fromDeclaringClass,
List<PropertyAccessor> readableBps,
Map<String,PropertyMutator> writableBps,
BeanCreator creator,
boolean failOnMissingProperty) |
| Modifier and Type | Method and Description |
|---|---|
protected T |
_deserWithCtrArgs(ObjectReader reader,
Context ctx) |
T |
deserialize(ObjectReader reader,
Context ctx) |
void |
deserialize(T into,
ObjectReader reader,
Context ctx) |
Class<T> |
getOfClass() |
boolean |
isReadable() |
boolean |
isWritable() |
void |
serialize(T obj,
ObjectWriter writer,
Context ctx) |
public BeanDescriptor(Class<T> forClass, Class<?> fromDeclaringClass, List<PropertyAccessor> readableBps, Map<String,PropertyMutator> writableBps, BeanCreator creator, boolean failOnMissingProperty)
public boolean isReadable()
public boolean isWritable()
public void serialize(T obj, ObjectWriter writer, Context ctx)
serialize in interface Converter<T>serialize in interface Serializer<T>obj - we want to serialize. The object is of type T or a subclass (if this serializer
has been registered for subclasses).writer - to use to write data to the output stream.ctx - the current context.public T deserialize(ObjectReader reader, Context ctx)
deserialize in interface Converter<T>deserialize in interface Deserializer<T>reader - used to read data from.ctx - the current context.public void deserialize(T into, ObjectReader reader, Context ctx)
protected T _deserWithCtrArgs(ObjectReader reader, Context ctx)
Copyright © 2019. All rights reserved.