Class BeanBuilder
java.lang.Object
com.fasterxml.jackson.module.mrbean.BeanBuilder
Heavy lifter of mr Bean package: class that keeps track of logical POJO properties,
and figures out how to create an implementation class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classHelper bean used to encapsulate most details of type handling -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String, POJOProperty> protected final com.fasterxml.jackson.databind.JavaTypeAbstract class or interface that the bean is created to extend or implement.protected final com.fasterxml.jackson.databind.introspect.AnnotatedClassprotected final com.fasterxml.jackson.databind.type.TypeFactoryprotected LinkedHashMap<String, Method> -
Constructor Summary
ConstructorsConstructorDescriptionBeanBuilder(com.fasterxml.jackson.databind.JavaType type, com.fasterxml.jackson.databind.introspect.AnnotatedClass ac, com.fasterxml.jackson.databind.type.TypeFactory tf) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidbyte[]Method that generates byte code for class that implements abstract types requested so far.protected StringbuildGetterName(String fieldName) protected StringbuildSetterName(String fieldName) protected com.fasterxml.jackson.databind.introspect.TypeResolutionContextbuildTypeContext(com.fasterxml.jackson.databind.JavaType ctxtType) protected Stringstatic BeanBuilderconstruct(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config, com.fasterxml.jackson.databind.JavaType type, com.fasterxml.jackson.databind.introspect.AnnotatedClass ac) protected voidcreateField(org.objectweb.asm.ClassWriter cw, POJOProperty prop, BeanBuilder.TypeDescription type) protected voidcreateGetter(org.objectweb.asm.ClassWriter cw, String internalClassName, POJOProperty prop, BeanBuilder.TypeDescription propertyType) protected voidcreateSetter(org.objectweb.asm.ClassWriter cw, String internalClassName, POJOProperty prop, BeanBuilder.TypeDescription propertyType) protected voidcreateUnimplementedMethod(org.objectweb.asm.ClassWriter cw, String internalClassName, Method method) Builder for methods that just throw an exception, basically "unsupported operation" implementation.protected Stringprotected POJOPropertyfindProperty(com.fasterxml.jackson.databind.introspect.TypeResolutionContext ctxt, String propName) protected static voidgenerateDefaultConstructor(org.objectweb.asm.ClassWriter cw, String superName) NOTE: only static because it is needed from TypeDetectorprotected StringgetInternalClassName(String className) protected StringgetPropertyName(String methodName) protected booleanhasConcreteOverride(Method m0, com.fasterxml.jackson.databind.JavaType 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.implement(boolean failOnUnrecognized) protected static final boolean
-
Field Details
-
_beanProperties
-
_unsupportedMethods
-
_type
protected final com.fasterxml.jackson.databind.JavaType _typeAbstract class or interface that the bean is created to extend or implement. -
_typeDefinition
protected final com.fasterxml.jackson.databind.introspect.AnnotatedClass _typeDefinition -
_typeFactory
protected final com.fasterxml.jackson.databind.type.TypeFactory _typeFactory
-
-
Constructor Details
-
BeanBuilder
public BeanBuilder(com.fasterxml.jackson.databind.JavaType type, com.fasterxml.jackson.databind.introspect.AnnotatedClass ac, com.fasterxml.jackson.databind.type.TypeFactory tf)
-
-
Method Details
-
construct
public static BeanBuilder construct(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config, com.fasterxml.jackson.databind.JavaType type, com.fasterxml.jackson.databind.introspect.AnnotatedClass ac) -
implement
- Parameters:
failOnUnrecognized- If true, and an unrecognized (non-getter, non-setter) method is encountered, will throwIllegalArgumentException; if false, will implement bogus method that will throwUnsupportedOperationExceptionif called.
-
build
Method that generates byte code for class that implements abstract types requested so far.- Parameters:
className- Fully-qualified name of the class to generate- Returns:
- Byte code Class instance built by this builder
-
hasConcreteOverride
protected boolean hasConcreteOverride(Method m0, com.fasterxml.jackson.databind.JavaType 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.- Since:
- 2.4
-
getPropertyName
-
buildGetterName
-
buildSetterName
-
getInternalClassName
-
addGetter
protected void addGetter(com.fasterxml.jackson.databind.introspect.TypeResolutionContext ctxt, Method m) -
addSetter
protected void addSetter(com.fasterxml.jackson.databind.introspect.TypeResolutionContext ctxt, Method m) -
findProperty
protected POJOProperty findProperty(com.fasterxml.jackson.databind.introspect.TypeResolutionContext ctxt, String propName) -
returnsBoolean
-
generateDefaultConstructor
protected static void generateDefaultConstructor(org.objectweb.asm.ClassWriter cw, String superName) NOTE: only static because it is needed from TypeDetector -
createField
protected void createField(org.objectweb.asm.ClassWriter cw, POJOProperty prop, BeanBuilder.TypeDescription type) -
createSetter
protected void createSetter(org.objectweb.asm.ClassWriter cw, String internalClassName, POJOProperty prop, BeanBuilder.TypeDescription propertyType) -
createGetter
protected void createGetter(org.objectweb.asm.ClassWriter cw, String internalClassName, POJOProperty prop, BeanBuilder.TypeDescription propertyType) -
createUnimplementedMethod
-
decap
-
cap
-
buildTypeContext
protected com.fasterxml.jackson.databind.introspect.TypeResolutionContext buildTypeContext(com.fasterxml.jackson.databind.JavaType ctxtType)
-