BeanBuilder
Date: 2017-02-10

com.fasterxml.jackson.module.mrbean

## Class BeanBuilder

- java.lang.Object
- - com.fasterxml.jackson.module.mrbean.BeanBuilder

-     public class BeanBuilder
      extends java.lang.Object

  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

    Fields
    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 Summary

    Constructors
    Constructor and Description
    `BeanBuilder(java.lang.Class<?> implType, com.fasterxml.jackson.databind.type.TypeFactory tf)`

  - ### Method Summary

    Methods
    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)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _beanProperties

          protected java.util.Map<java.lang.String,POJOProperty> _beanProperties

    - #### _unsupportedMethods

          protected java.util.LinkedHashMap<java.lang.String,java.lang.reflect.Method> _unsupportedMethods

    - #### _implementedType

          protected final java.lang.Class<?> _implementedType

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

    - #### _typeFactory

          protected final com.fasterxml.jackson.databind.type.TypeFactory _typeFactory

  - ### Constructor Detail

    - #### BeanBuilder

          public BeanBuilder(java.lang.Class<?> implType,
                     com.fasterxml.jackson.databind.type.TypeFactory tf)

  - ### Method Detail

    - #### implement

          public BeanBuilder implement(boolean failOnUnrecognized)

      Parameters:
        `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.

    - #### build

          public byte[] build(java.lang.String className)

      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(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.
      Since:
        2.4

    - #### getPropertyName

          protected java.lang.String getPropertyName(java.lang.String methodName)

    - #### buildGetterName

          protected java.lang.String buildGetterName(java.lang.String fieldName)

    - #### buildSetterName

          protected java.lang.String buildSetterName(java.lang.String fieldName)

    - #### getInternalClassName

          protected java.lang.String getInternalClassName(java.lang.String className)

    - #### addGetter

          protected void addGetter(java.lang.reflect.Method m)

    - #### addSetter

          protected void addSetter(java.lang.reflect.Method m)

    - #### findProperty

          protected POJOProperty findProperty(java.lang.String propName)

    - #### returnsBoolean

          protected static final boolean returnsBoolean(java.lang.reflect.Method m)

    - #### generateDefaultConstructor

          protected static void generateDefaultConstructor(org.objectweb.asm.ClassWriter cw,
                                        java.lang.String superName)

      NOTE: only static because it is needed from TypeDetector

    - #### createField

          protected void createField(org.objectweb.asm.ClassWriter cw,
                         POJOProperty prop,
                         com.fasterxml.jackson.module.mrbean.BeanBuilder.TypeDescription type)

    - #### createSetter

          protected void createSetter(org.objectweb.asm.ClassWriter cw,
                          java.lang.String internalClassName,
                          POJOProperty prop,
                          com.fasterxml.jackson.module.mrbean.BeanBuilder.TypeDescription propertyType)

    - #### createGetter

          protected void createGetter(org.objectweb.asm.ClassWriter cw,
                          java.lang.String internalClassName,
                          POJOProperty prop,
                          com.fasterxml.jackson.module.mrbean.BeanBuilder.TypeDescription propertyType)

    - #### createUnimplementedMethod

          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.

    - #### decap

          protected java.lang.String decap(java.lang.String name)

    - #### cap

          protected java.lang.String cap(java.lang.String prefix,
                             java.lang.String name)