public class BeanBuilder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,POJOProperty> |
_beanProperties |
protected java.lang.Class<?> |
_implementedType
Abstract class or interface that the bean is created to extend or implement.
|
protected com.fasterxml.jackson.databind.type.TypeFactory |
_typeFactory |
protected java.util.LinkedHashMap<java.lang.String,java.lang.reflect.Method> |
_unsupportedMethods |
Constructor and Description |
---|
BeanBuilder(java.lang.Class<?> implType,
com.fasterxml.jackson.databind.type.TypeFactory tf) |
Modifier and Type | Method and Description |
---|---|
protected void |
addGetter(java.lang.reflect.Method m) |
protected void |
addSetter(java.lang.reflect.Method m) |
byte[] |
build(java.lang.String className)
Method that generates byte code for class that implements abstract
types requested so far.
|
protected java.lang.String |
buildGetterName(java.lang.String fieldName) |
protected java.lang.String |
buildSetterName(java.lang.String fieldName) |
protected java.lang.String |
cap(java.lang.String prefix,
java.lang.String name) |
protected void |
createField(org.objectweb.asm.ClassWriter cw,
POJOProperty prop,
com.fasterxml.jackson.module.mrbean.BeanBuilder.TypeDescription type) |
protected void |
createGetter(org.objectweb.asm.ClassWriter cw,
java.lang.String internalClassName,
POJOProperty prop,
com.fasterxml.jackson.module.mrbean.BeanBuilder.TypeDescription propertyType) |
protected void |
createSetter(org.objectweb.asm.ClassWriter cw,
java.lang.String internalClassName,
POJOProperty prop,
com.fasterxml.jackson.module.mrbean.BeanBuilder.TypeDescription propertyType) |
protected void |
createUnimplementedMethod(org.objectweb.asm.ClassWriter cw,
java.lang.String internalClassName,
java.lang.reflect.Method method)
Builder for methods that just throw an exception, basically "unsupported
operation" implementation.
|
protected java.lang.String |
decap(java.lang.String name) |
protected POJOProperty |
findProperty(java.lang.String propName) |
protected static void |
generateDefaultConstructor(org.objectweb.asm.ClassWriter cw,
java.lang.String superName)
NOTE: only static because it is needed from TypeDetector
|
protected java.lang.String |
getInternalClassName(java.lang.String className) |
protected java.lang.String |
getPropertyName(java.lang.String methodName) |
protected boolean |
hasConcreteOverride(java.lang.reflect.Method m0,
java.lang.Class<?> implementedType)
Helper method used to detect if an abstract method found in a base class
may actually be implemented in a (more) concrete sub-class.
|
BeanBuilder |
implement(boolean failOnUnrecognized) |
protected static boolean |
returnsBoolean(java.lang.reflect.Method m) |
protected java.util.Map<java.lang.String,POJOProperty> _beanProperties
protected java.util.LinkedHashMap<java.lang.String,java.lang.reflect.Method> _unsupportedMethods
protected final java.lang.Class<?> _implementedType
protected final com.fasterxml.jackson.databind.type.TypeFactory _typeFactory
public BeanBuilder(java.lang.Class<?> implType, com.fasterxml.jackson.databind.type.TypeFactory tf)
public BeanBuilder implement(boolean failOnUnrecognized)
failOnUnrecognized
- If true, and an unrecognized (non-getter, non-setter)
method is encountered, will throw IllegalArgumentException
; if false,
will implement bogus method that will throw UnsupportedOperationException
if called.public byte[] build(java.lang.String className)
className
- Fully-qualified name of the class to generateprotected boolean hasConcreteOverride(java.lang.reflect.Method m0, java.lang.Class<?> implementedType)
protected java.lang.String getPropertyName(java.lang.String methodName)
protected java.lang.String buildGetterName(java.lang.String fieldName)
protected java.lang.String buildSetterName(java.lang.String fieldName)
protected java.lang.String getInternalClassName(java.lang.String className)
protected void addGetter(java.lang.reflect.Method m)
protected void addSetter(java.lang.reflect.Method m)
protected POJOProperty findProperty(java.lang.String propName)
protected static final boolean returnsBoolean(java.lang.reflect.Method m)
protected static void generateDefaultConstructor(org.objectweb.asm.ClassWriter cw, java.lang.String superName)
protected void createField(org.objectweb.asm.ClassWriter cw, POJOProperty prop, com.fasterxml.jackson.module.mrbean.BeanBuilder.TypeDescription type)
protected void createSetter(org.objectweb.asm.ClassWriter cw, java.lang.String internalClassName, POJOProperty prop, com.fasterxml.jackson.module.mrbean.BeanBuilder.TypeDescription propertyType)
protected void createGetter(org.objectweb.asm.ClassWriter cw, java.lang.String internalClassName, POJOProperty prop, com.fasterxml.jackson.module.mrbean.BeanBuilder.TypeDescription propertyType)
protected void createUnimplementedMethod(org.objectweb.asm.ClassWriter cw, java.lang.String internalClassName, java.lang.reflect.Method method)
protected java.lang.String decap(java.lang.String name)
protected java.lang.String cap(java.lang.String prefix, java.lang.String name)