Class MethodWrapper
- java.lang.Object
-
- de.aristaflow.adept2.util.reflection.MethodWrapper
-
public class MethodWrapper extends Object
Simple class allowing for treating methods and constructors similar. This allows to use the same code to search for an appropriate initialisation method or constructor.
-
-
Field Summary
Fields Modifier and Type Field Description protected Constructor<?>
constructor
The wrapped constructor ornull
in case of a wrapped method.protected Method
method
The wrapped method ornull
in case of a wrapped constructor.
-
Constructor Summary
Constructors Constructor Description MethodWrapper(Constructor<?> constructor)
Creates a new wrapper for the designated constructor.MethodWrapper(Method method)
Creates a new wrapper for the designated method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Constructor<?>
getConstructor()
Gets the wrapped constructor ornull
in case of a wrapped method.Method
getMethod()
Gets the wrapped method ornull
in case of a wrapped constructor.String
getName()
Gets the name of the wrapped method or constructor.Class<?>[]
getParameterTypes()
Gets the parameter types of the wrapped method or constructor.
-
-
-
Field Detail
-
method
protected final Method method
The wrapped method ornull
in case of a wrapped constructor.
-
constructor
protected final Constructor<?> constructor
The wrapped constructor ornull
in case of a wrapped method.
-
-
Constructor Detail
-
MethodWrapper
public MethodWrapper(Method method)
Creates a new wrapper for the designated method.- Parameters:
method
- The wrapped method.
-
MethodWrapper
public MethodWrapper(Constructor<?> constructor)
Creates a new wrapper for the designated constructor.- Parameters:
constructor
- The wrapped constructor.
-
-
Method Detail
-
getMethod
public Method getMethod()
Gets the wrapped method ornull
in case of a wrapped constructor.- Returns:
- The wrapped method or
null
in case of a wrapped constructor.
-
getConstructor
public Constructor<?> getConstructor()
Gets the wrapped constructor ornull
in case of a wrapped method.- Returns:
- The wrapped constructor or
null
in case of a wrapped method.
-
getName
public String getName()
Gets the name of the wrapped method or constructor.- Returns:
- The name of the wrapped method or constructor.
-
getParameterTypes
public Class<?>[] getParameterTypes()
Gets the parameter types of the wrapped method or constructor.- Returns:
- The parameter types of the wrapped method or constructor.
-
-