Package jadex.commons
Class MethodInfo
- java.lang.Object
-
- jadex.commons.MethodInfo
-
public class MethodInfo extends java.lang.ObjectAll info for identifying a method.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ClassLoaderclassloaderThe classloader with which this info was loaded.protected java.lang.StringclassnameCached class.protected java.lang.reflect.MethodmethodCached method.protected java.lang.StringnameThe method name.protected ClassInfo[]parametertypesThe parameter classes.protected ClassInforeturntypeCached return type.
-
Constructor Summary
Constructors Constructor Description MethodInfo()Create a new method info.MethodInfo(java.lang.reflect.Method m)Create a new method info.MethodInfo(java.lang.String name, ClassInfo[] parametertypes)Create a new method info.MethodInfo(java.lang.String name, java.lang.Class<?>[] parametertypes)Create a new method info.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Test if an object is equal to this.java.lang.StringgetClassName()Gets the class name for retrieving the method.java.lang.reflect.MethodgetMethod(java.lang.ClassLoader cl)java.lang.StringgetName()Get the name.java.lang.StringgetNameWithParameters()Get the name with parameters, e.g.ClassInfo[]getParameterTypeInfos()Get the parametertypes.java.lang.Class<?>[]getParameterTypes(java.lang.ClassLoader cl)Get the parametertypes as classes.ClassInfogetReturnTypeInfo()Get the return type.inthashCode()Get the hashcode.voidsetClassName(java.lang.String classname)Sets the class name for retrieving the method.voidsetName(java.lang.String name)Set the name.voidsetParameterTypeInfos(ClassInfo[] parametertypes)Set the parametertypes.voidsetParameterTypes(java.lang.Class<?>[] parametertypes)Get the parametertypes as classes.voidsetReturnTypeInfo(ClassInfo returntype)Set the return type.java.lang.StringtoString()Get the string representation.
-
-
-
Field Detail
-
name
protected java.lang.String name
The method name.
-
parametertypes
protected ClassInfo[] parametertypes
The parameter classes.
-
returntype
protected ClassInfo returntype
Cached return type.
-
classname
protected java.lang.String classname
Cached class.
-
method
protected java.lang.reflect.Method method
Cached method.
-
classloader
protected java.lang.ClassLoader classloader
The classloader with which this info was loaded. Note 1: This must not be the same as method.getClass().getClassLoader() because the latter returns the loader responsible for the class which could be higher in the parent hierarchy. Note 2: The check current_cl==last_cl is not perfect because when invoked with a parent classloader it will reload the class (although not necessary)
-
-
Constructor Detail
-
MethodInfo
public MethodInfo()
Create a new method info.
-
MethodInfo
public MethodInfo(java.lang.reflect.Method m)
Create a new method info.
-
MethodInfo
public MethodInfo(java.lang.String name, java.lang.Class<?>[] parametertypes)Create a new method info.
-
MethodInfo
public MethodInfo(java.lang.String name, ClassInfo[] parametertypes)Create a new method info.
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the name.- Returns:
- the name.
-
setName
public void setName(java.lang.String name)
Set the name.- Parameters:
name- The name to set.
-
getParameterTypes
public java.lang.Class<?>[] getParameterTypes(java.lang.ClassLoader cl)
Get the parametertypes as classes.- Returns:
- the parametertypes.
-
setParameterTypes
public void setParameterTypes(java.lang.Class<?>[] parametertypes)
Get the parametertypes as classes.
-
getParameterTypeInfos
public ClassInfo[] getParameterTypeInfos()
Get the parametertypes.- Returns:
- the parametertypes.
-
setParameterTypeInfos
public void setParameterTypeInfos(ClassInfo[] parametertypes)
Set the parametertypes.- Parameters:
parametertypes- The parametertypes to set.
-
getReturnTypeInfo
public ClassInfo getReturnTypeInfo()
Get the return type.- Returns:
- The return type.
-
setReturnTypeInfo
public void setReturnTypeInfo(ClassInfo returntype)
Set the return type.- Parameters:
returntype- the returntype to set
-
setClassName
public void setClassName(java.lang.String classname)
Sets the class name for retrieving the method.- Parameters:
classname- Name of the class.
-
getClassName
public java.lang.String getClassName()
Gets the class name for retrieving the method.
-
getMethod
public java.lang.reflect.Method getMethod(java.lang.ClassLoader cl)
-
hashCode
public int hashCode()
Get the hashcode.- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Test if an object is equal to this.- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
Get the string representation.- Overrides:
toStringin classjava.lang.Object
-
getNameWithParameters
public java.lang.String getNameWithParameters()
Get the name with parameters, e.g. method1(String, int) but without return type.
-
-