public class AddMethodPrimitive extends MethodPrimitive
| Modifier and Type | Field and Description |
|---|---|
protected com.github.javaparser.ast.body.MethodDeclaration |
declaration |
protected com.github.javaparser.ast.body.MethodDeclaration |
invoker |
static int |
MODIFIERS |
exceptionClasses, exceptions, modifiers, parameterClasses, returnClasschangesClassHierarchy, classContent, clazz, modifiedClasses| Constructor and Description |
|---|
AddMethodPrimitive(ClassContent classContent,
java.lang.String name,
java.lang.Class<?> returnClass,
java.lang.Class<?>[] parameterClasses,
java.lang.Class<?>[] exceptions,
java.lang.String[] paramNames,
java.lang.String body,
int modifiers) |
AddMethodPrimitive(ClassContent classContent,
java.lang.String name,
java.lang.Class<?> returnClass,
java.lang.Class<?>[] parameterClasses,
java.lang.Class<?>[] exceptions,
java.lang.String[] paramNames,
java.lang.String body,
int modifiers,
java.lang.reflect.Type[] genericParamTypes,
java.lang.reflect.Type genericReturnType,
TypeVariable<?>[] methodTypeParameters) |
AddMethodPrimitive(ClassContent classContent,
java.lang.String name,
java.lang.Class<?> returnClass,
java.lang.Class<?>[] parameterClasses,
java.lang.String[] paramNames,
java.lang.String body,
int modifiers) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
executePrimitive()
Adds the method and the invoker to the source code of the class
|
protected void |
generateBody(java.lang.String body)
Parse the body of the method
|
protected void |
generateInvoker(java.lang.String name)
Generates invoker method
|
protected void |
generateMethod(java.lang.String name,
java.lang.String[] paramNames,
java.lang.String body)
Generates the method declaration
|
protected void |
initializeFields(java.lang.String name,
java.lang.String[] paramNames,
java.lang.String body)
Generates the members needed in the primitive execution
|
protected void |
undoPrimitive()
Reverts the changes
|
getBodyInvoker, getDescriptor, getInvokerDescriptor, setThrowschangeVersion, execute, getSuperClass, getTargetClass, isSafe, undo, undoUpdateVersion, updateVersion, updateVersionpublic static final int MODIFIERS
protected com.github.javaparser.ast.body.MethodDeclaration declaration
protected com.github.javaparser.ast.body.MethodDeclaration invoker
public AddMethodPrimitive(ClassContent classContent, java.lang.String name, java.lang.Class<?> returnClass, java.lang.Class<?>[] parameterClasses, java.lang.Class<?>[] exceptions, java.lang.String[] paramNames, java.lang.String body, int modifiers)
public AddMethodPrimitive(ClassContent classContent, java.lang.String name, java.lang.Class<?> returnClass, java.lang.Class<?>[] parameterClasses, java.lang.Class<?>[] exceptions, java.lang.String[] paramNames, java.lang.String body, int modifiers, java.lang.reflect.Type[] genericParamTypes, java.lang.reflect.Type genericReturnType, TypeVariable<?>[] methodTypeParameters)
public AddMethodPrimitive(ClassContent classContent, java.lang.String name, java.lang.Class<?> returnClass, java.lang.Class<?>[] parameterClasses, java.lang.String[] paramNames, java.lang.String body, int modifiers)
protected void initializeFields(java.lang.String name,
java.lang.String[] paramNames,
java.lang.String body)
throws com.github.javaparser.ParseException,
StructuralIntercessionException
name - The name of the methodparamNames - Parameter namesbody - Body of the methodcom.github.javaparser.ParseExceptionStructuralIntercessionExceptionprotected void generateInvoker(java.lang.String name)
throws com.github.javaparser.ParseException
name - The name of the methodcom.github.javaparser.ParseExceptionprotected void generateMethod(java.lang.String name,
java.lang.String[] paramNames,
java.lang.String body)
throws com.github.javaparser.ParseException,
StructuralIntercessionException
name - The name of the methodparamNames - Parameter namesbody - Body of the methodcom.github.javaparser.ParseExceptionStructuralIntercessionExceptionprotected void generateBody(java.lang.String body)
throws com.github.javaparser.ParseException
body - Source code of the methodcom.github.javaparser.ParseExceptionprotected void executePrimitive()
throws StructuralIntercessionException
executePrimitive in class AbstractPrimitiveStructuralIntercessionException - If there are any errorprotected void undoPrimitive()
throws StructuralIntercessionException
undoPrimitive in class AbstractPrimitiveStructuralIntercessionException - If there are any error