Package jadex.commons
Class MethodInfo
- java.lang.Object
-
- jadex.commons.MethodInfo
-
public class MethodInfo extends java.lang.Object
All info for identifying a method.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ClassLoader
classloader
The classloader with which this info was loaded.protected java.lang.String
classname
Cached class.protected java.lang.reflect.Method
method
Cached method.protected java.lang.String
name
The method name.protected ClassInfo[]
parametertypes
The parameter classes.protected ClassInfo
returntype
Cached 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 boolean
equals(java.lang.Object obj)
Test if an object is equal to this.java.lang.String
getClassName()
Gets the class name for retrieving the method.java.lang.reflect.Method
getMethod(java.lang.ClassLoader cl)
java.lang.String
getName()
Get the name.java.lang.String
getNameWithParameters()
Get the name with parameters, e.g. method1(String, int) but without return type.ClassInfo[]
getParameterTypeInfos()
Get the parametertypes.java.lang.Class<?>[]
getParameterTypes(java.lang.ClassLoader cl)
Get the parametertypes as classes.ClassInfo
getReturnTypeInfo()
Get the return type.int
hashCode()
Get the hashcode.void
setClassName(java.lang.String classname)
Sets the class name for retrieving the method.void
setName(java.lang.String name)
Set the name.void
setParameterTypeInfos(ClassInfo[] parametertypes)
Set the parametertypes.void
setParameterTypes(java.lang.Class<?>[] parametertypes)
Get the parametertypes as classes.void
setReturnTypeInfo(ClassInfo returntype)
Set the return type.java.lang.String
toString()
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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Test if an object is equal to this.- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
Get the string representation.- Overrides:
toString
in classjava.lang.Object
-
getNameWithParameters
public java.lang.String getNameWithParameters()
Get the name with parameters, e.g. method1(String, int) but without return type.
-
-