com.fasterxml.jackson.module.afterburner.deser.SuperSonicDeserializerBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jackson-module-afterburner Show documentation
Show all versions of jackson-module-afterburner Show documentation
Jackson (https://github.com/FasterXML/jackson) extension module
used to enhance performance using bytecode generation to replace use of Reflection for
field access and method calls
package com.fasterxml.jackson.module.afterburner.deser;
import java.util.*;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.deser.*;
public class SuperSonicDeserializerBuilder extends BeanDeserializerBuilder
{
public SuperSonicDeserializerBuilder(BeanDeserializerBuilder base) {
super(base);
}
@Override
public JsonDeserializer> build() throws JsonMappingException
{
BeanDeserializer deser = (BeanDeserializer) super.build();
// only create custom one, if existing one is standard deserializer;
if (deser.getClass() == BeanDeserializer.class) {
BeanDeserializer beanDeser = (BeanDeserializer) deser;
Iterator it = getProperties();
// also: only build custom one for non-empty beans:
if (it.hasNext()) {
// So let's find actual order of properties, necessary for optimal access
ArrayList props = new ArrayList();
do {
props.add(it.next());
} while (it.hasNext());
return new SuperSonicBeanDeserializer(beanDeser, props);
}
}
return deser;
}
}