JavassistBuilder¶
-
public final class
JavassistBuilder¶ Builder class for javassist related tasks. Helps with building appropriate elements of class e.g. fields, getters, field initializer
Methods¶
createCollectionInitializer¶
createEnumInitializer¶
createField¶
-
public static CtField
createField(CtClass declaring, CtClass type, String name, String genericSignature)¶ Creates class field with the given name for the given class declaration and type.
Parameters: - declaring – the class to which the field will be added
- type – the field type
- name – the field name
- genericSignature – the generic signature
Throws: - CannotCompileException – when bytecode transformation has failed
Returns: An instance of
javassist.CtFieldrepresents a field
createGetter¶
-
public static CtMethod
createGetter(String fieldName, CtClass declaring, CtField field)¶ Creates a public getter method with the given field name for the given class declaration and type.
Parameters: - fieldName – the field name
- declaring – the class to which the getter will be added
- field – the field declaration
Throws: - CannotCompileException – when bytecode transformation has failed
Returns: An instance of
javassist.CtMethodrepresents a getter method
createInitializer¶
createInitializer¶
createJavaTimeInitializer¶
-
public static CtField.Initializer
createJavaTimeInitializer(String type, String defaultValue)¶ Makes a initializer for
java.time.LocalDateorjava.time.LocalDateTimeclassParameters: - type – the field type
- defaultValue – the default value as string
Returns: java.time.LocalDateorjava.time.LocalDateTimeinitializer based on a type parameter
createListInitializer¶
createLocaleInitializer¶
-
public static CtField.Initializer
createLocaleInitializer(Object defaultValue)¶ Makes an initializer for
java.util.Localeclass.Parameters: - defaultValue – the default value
Returns: java.util.Localeinitializer
createSetInitializer¶
createSetter¶
-
public static CtMethod
createSetter(String fieldName, CtField field)¶ Creates a public setter method with the given field name for the given class declaration and type.
Parameters: - fieldName – the field name
- field – the field declaration
Throws: - CannotCompileException – when bytecode transformation has failed
Returns: An instance of
javassist.CtMethodrepresents a setter method