From e5e20e3b8bbb225e10d6b7528e67105ebed75214 Mon Sep 17 00:00:00 2001 From: Clisprail Date: Tue, 5 Aug 2014 01:31:46 +0200 Subject: [PATCH] RefMethod added --- .../org/parabot/core/reflect/RefMethod.java | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 parabotv2/src/org/parabot/core/reflect/RefMethod.java diff --git a/parabotv2/src/org/parabot/core/reflect/RefMethod.java b/parabotv2/src/org/parabot/core/reflect/RefMethod.java new file mode 100644 index 0000000..86516f0 --- /dev/null +++ b/parabotv2/src/org/parabot/core/reflect/RefMethod.java @@ -0,0 +1,88 @@ +package org.parabot.core.reflect; + +import java.lang.reflect.Method; + +/** + * + * A RefMethod class represent a method of a RefClass. + * + * @author Everel + * + */ +public class RefMethod extends RefModifiers { + private Method method; + + public RefMethod(Method method) { + super(method.getModifiers()); + } + + /** + * Get the value of the accessible flag for this object. + * + * @return the value of the object's accessible flag + */ + public boolean isAccessible() { + return method.isAccessible(); + } + + /** + * Returns true if this method is a synthetic method; returns + * false otherwise. + * + * @return true if this method is a synthetic method; returns + * false otherwise + */ + public boolean isSynthetic() { + return method.isSynthetic(); + } + + /** + * Returns the name of the method. + * + * @return name of the method + */ + public String getName() { + return method.getName(); + } + + /** + * Returns an array of the parameter types of this method + * @return an array of the parameter types of this method + */ + public Class[] getParameterTypes() { + return method.getParameterTypes(); + } + + /** + * Gets the return type of this class + * @return return type of this class + */ + public Class getReturnType() { + return method.getReturnType(); + } + + /** + * Gets the return type of this class + * @return return type of this class + */ + public org.objectweb.asm.Type getASMReturnType() { + return org.objectweb.asm.Type.getType(getReturnType()); + } + + /** + * Gets the java reflection API method representation + * + * @return constructor + */ + public Method getMethod() { + return this.method; + } + + public String toGenericString() { + return method.toGenericString(); + } + + public String toString() { + return method.toString(); + } +}