Top Description Fields Constructors Methods
tools.jackson.module.mrbean

public Class BeanBuilder

extends Object
Class Inheritance
Imports
tools.jackson.databind.JavaType, tools.jackson.databind.cfg.MapperConfig, tools.jackson.databind.introspect.AnnotatedClass, .TypeResolutionContext, tools.jackson.databind.type.TypeFactory, net.bytebuddy.ByteBuddy, net.bytebuddy.description.modifier.Visibility, net.bytebuddy.description.type.TypeDefinition, net.bytebuddy.dynamic.DynamicType, net.bytebuddy.dynamic.scaffold.TypeValidation, net.bytebuddy.implementation.ExceptionMethod, .FieldAccessor, java.lang.reflect.Method, .Modifier, java.util.ArrayList, .LinkedHashMap, .Map

Heavy lifter of mr Bean package: class that keeps track of logical POJO properties, and figures out how to create an implementation class.

Field Summary

Modifier and TypeField and Description
protected Map<String, POJOProperty>
protected final JavaType
_type

Abstract class or interface that the bean is created to extend or implement.

protected final AnnotatedClass
protected final TypeFactory
protected LinkedHashMap<String, Method>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
public byte[]

Returns:

Byte code Class instance built by this builder
build
(String
Fully-qualified name of the class to generate
className
)

Method that generates byte code for class that implements abstract types requested so far.

protected String
protected String
protected TypeResolutionContext
protected String
cap(String prefix, String name)

public static BeanBuilder
private DynamicType.Builder<?>
createField(DynamicType.Builder<?> builder, POJOProperty property, TypeDefinition typeDefinition)

private DynamicType.Builder<?>
createGetter(DynamicType.Builder<?> builder, POJOProperty property, TypeDefinition typeDefinition)

private DynamicType.Builder<?>
createSetter(DynamicType.Builder<?> builder, POJOProperty property, TypeDefinition typeDefinition)

protected String
decap(String name)

protected POJOProperty
private TypeDefinition
protected String
protected String
getPropertyName(String methodName)

protected boolean
hasConcreteOverride(Method m0, 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.

public BeanBuilder
implement(boolean
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.
failOnUnrecognized
)

protected static final boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_beanPropertiesback to summary
protected Map<String, POJOProperty> _beanProperties
_typeback to summary
protected final JavaType _type

Abstract class or interface that the bean is created to extend or implement.

_typeDefinitionback to summary
protected final AnnotatedClass _typeDefinition
_typeFactoryback to summary
protected final TypeFactory _typeFactory
_unsupportedMethodsback to summary
protected LinkedHashMap<String, Method> _unsupportedMethods

Constructor Detail

BeanBuilderback to summary
public BeanBuilder(JavaType type, AnnotatedClass ac, TypeFactory tf)

Method Detail

addGetterback to summary
protected void addGetter(TypeResolutionContext ctxt, Method m)
addSetterback to summary
protected void addSetter(TypeResolutionContext ctxt, Method m)
buildback to summary
public byte[] build(String className)

Method that generates byte code for class that implements abstract types requested so far.

Parameters
className:String

Fully-qualified name of the class to generate

Returns:byte[]

Byte code Class instance built by this builder

buildGetterNameback to summary
protected String buildGetterName(String fieldName)
buildSetterNameback to summary
protected String buildSetterName(String fieldName)
buildTypeContextback to summary
protected TypeResolutionContext buildTypeContext(JavaType ctxtType)
capback to summary
protected String cap(String prefix, String name)
constructback to summary
public static BeanBuilder construct(MapperConfig<?> config, JavaType type, AnnotatedClass ac)
createFieldback to summary
private DynamicType.Builder<?> createField(DynamicType.Builder<?> builder, POJOProperty property, TypeDefinition typeDefinition)
createGetterback to summary
private DynamicType.Builder<?> createGetter(DynamicType.Builder<?> builder, POJOProperty property, TypeDefinition typeDefinition)
createSetterback to summary
private DynamicType.Builder<?> createSetter(DynamicType.Builder<?> builder, POJOProperty property, TypeDefinition typeDefinition)
decapback to summary
protected String decap(String name)
findPropertyback to summary
protected POJOProperty findProperty(TypeResolutionContext ctxt, String propName)
getFieldTypeback to summary
private TypeDefinition getFieldType(POJOProperty property)
getInternalClassNameback to summary
protected String getInternalClassName(String className)
getPropertyNameback to summary
protected String getPropertyName(String methodName)
hasConcreteOverrideback to summary
protected boolean hasConcreteOverride(Method m0, 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
implementback to summary
public BeanBuilder implement(boolean failOnUnrecognized)
Parameters
failOnUnrecognized:boolean

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.

returnsBooleanback to summary
protected static final boolean returnsBoolean(Method m)