Class JavaSourceMethod
- java.lang.Object
-
- gw.lang.reflect.java.JavaSourceElement
-
- gw.internal.gosu.parser.java.classinfo.JavaSourceMethod
-
- All Implemented Interfaces:
IJavaAnnotatedElement
,IJavaClassMethod
,ITypeInfoResolver
,Serializable
,Comparable<IJavaClassMethod>
- Direct Known Subclasses:
JavaSourceAnnotationMethod
,JavaSourceConstructor
public class JavaSourceMethod extends JavaSourceElement implements IJavaClassMethod, ITypeInfoResolver
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected JavaSourceType
_containingClass
protected IJavaClassType[]
_genericParameterTypes
protected IJavaClassType
_genericReturnType
protected com.sun.source.tree.MethodTree
_method
protected JavaSourceModifierList
_modifierList
protected JavaSourceParameter[]
_parameters
protected IJavaClassInfo[]
_parameterTypes
protected IJavaClassInfo
_returnType
protected IJavaClassTypeVariable[]
_typeParameters
-
Constructor Summary
Constructors Constructor Description JavaSourceMethod(com.sun.source.tree.MethodTree method, JavaSourceType containingClass)
-
Method Summary
-
Methods inherited from class gw.lang.reflect.java.JavaSourceElement
findInnerSourceType, getCompilationUnitTree, getDeclaringClass, getEndPosition, getLocationInfo, getSourcePositions, getStartPosition
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.lang.reflect.java.IJavaAnnotatedElement
getLocationInfo
-
-
-
-
Field Detail
-
_method
protected com.sun.source.tree.MethodTree _method
-
_containingClass
protected JavaSourceType _containingClass
-
_parameters
protected JavaSourceParameter[] _parameters
-
_genericReturnType
protected IJavaClassType _genericReturnType
-
_modifierList
protected JavaSourceModifierList _modifierList
-
_typeParameters
protected IJavaClassTypeVariable[] _typeParameters
-
_genericParameterTypes
protected IJavaClassType[] _genericParameterTypes
-
_parameterTypes
protected IJavaClassInfo[] _parameterTypes
-
_returnType
protected IJavaClassInfo _returnType
-
-
Constructor Detail
-
JavaSourceMethod
public JavaSourceMethod(com.sun.source.tree.MethodTree method, JavaSourceType containingClass)
-
-
Method Detail
-
getReturnClassInfo
public IJavaClassInfo getReturnClassInfo()
- Specified by:
getReturnClassInfo
in interfaceIJavaClassMethod
-
getGenericReturnType
public IJavaClassType getGenericReturnType()
- Specified by:
getGenericReturnType
in interfaceIJavaClassMethod
-
getReturnTypeName
public String getReturnTypeName()
- Specified by:
getReturnTypeName
in interfaceIJavaClassMethod
-
getReturnType
public IType getReturnType()
- Specified by:
getReturnType
in interfaceIJavaClassMethod
-
getGenericParameterTypes
public IJavaClassType[] getGenericParameterTypes()
- Specified by:
getGenericParameterTypes
in interfaceIJavaClassMethod
-
getParameterTypes
public IJavaClassInfo[] getParameterTypes()
- Specified by:
getParameterTypes
in interfaceIJavaClassMethod
-
getName
public String getName()
- Specified by:
getName
in interfaceIJavaClassMethod
-
getParameterInfos
public List<Parameter> getParameterInfos()
- Specified by:
getParameterInfos
in interfaceIJavaClassMethod
-
getParameters
public JavaSourceParameter[] getParameters()
-
isConstructor
public boolean isConstructor()
-
getTree
public com.sun.source.tree.Tree getTree()
- Specified by:
getTree
in classJavaSourceElement
-
getEnclosingClass
public JavaSourceType getEnclosingClass()
- Specified by:
getEnclosingClass
in interfaceIJavaAnnotatedElement
- Specified by:
getEnclosingClass
in classJavaSourceElement
-
getModifiers
public int getModifiers()
- Specified by:
getModifiers
in interfaceIJavaClassMethod
-
getModifierList
public IModifierList getModifierList()
-
getExceptionTypes
public IJavaClassInfo[] getExceptionTypes()
- Specified by:
getExceptionTypes
in interfaceIJavaClassMethod
-
resolveType
public IJavaClassType resolveType(String relativeName, int ignoreFlags)
- Specified by:
resolveType
in interfaceITypeInfoResolver
-
resolveType
public IJavaClassType resolveType(String relativeName, IJavaClassInfo whosAskin, int ignoreFlags)
- Specified by:
resolveType
in interfaceITypeInfoResolver
-
resolveImport
public IJavaClassType resolveImport(String relativeName)
- Specified by:
resolveImport
in interfaceITypeInfoResolver
-
getModule
public IModule getModule()
- Specified by:
getModule
in interfaceITypeInfoResolver
-
isAnnotationPresent
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
Description copied from interface:IJavaAnnotatedElement
Returns true if an annotation for the specified type is present on this element, else false. This method is designed primarily for convenient access to marker annotations.- Specified by:
isAnnotationPresent
in interfaceIJavaAnnotatedElement
- Parameters:
annotationClass
- the Class object corresponding to the annotation type- Returns:
- true if an annotation for the specified annotation type is present on this element, else false
-
getAnnotation
public IAnnotationInfo getAnnotation(Class annotationClass)
Description copied from interface:IJavaAnnotatedElement
Returns this element's annotation for the specified type if such an annotation is present, else null.- Specified by:
getAnnotation
in interfaceIJavaAnnotatedElement
- Parameters:
annotationClass
- the Class object corresponding to the annotation type- Returns:
- this element's annotation for the specified annotation type if present on this element, else null
-
getDeclaredAnnotations
public IAnnotationInfo[] getDeclaredAnnotations()
Description copied from interface:IJavaAnnotatedElement
Returns all annotations that are directly present on this element. Unlike the other methods in this interface, this method ignores inherited annotations. (Returns an array of length zero if no annotations are directly present on this element.) The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.- Specified by:
getDeclaredAnnotations
in interfaceIJavaAnnotatedElement
- Returns:
- All annotations directly present on this element
-
initParameterTypes
protected IJavaClassInfo[] initParameterTypes()
-
initGenericParameterTypes
protected IJavaClassType[] initGenericParameterTypes()
-
getDefaultValue
public Object getDefaultValue()
- Specified by:
getDefaultValue
in interfaceIJavaClassMethod
-
invoke
public Object invoke(Object ctx, Object[] args) throws InvocationTargetException, IllegalAccessException
- Specified by:
invoke
in interfaceIJavaClassMethod
- Throws:
InvocationTargetException
IllegalAccessException
-
getTypeParameters
public IJavaClassTypeVariable[] getTypeParameters()
-
getTypeVariables
public IGenericTypeVariable[] getTypeVariables(IJavaMethodInfo mi)
- Specified by:
getTypeVariables
in interfaceIJavaClassMethod
-
isBridge
public boolean isBridge()
- Specified by:
isBridge
in interfaceIJavaClassMethod
-
isSynthetic
public boolean isSynthetic()
- Specified by:
isSynthetic
in interfaceIJavaClassMethod
-
create
public static JavaSourceMethod create(com.sun.source.tree.MethodTree method, JavaSourceType containingClass)
-
getActualParameterInfos
protected IParameterInfo[] getActualParameterInfos(IFeatureInfo container, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars)
-
compareTo
public int compareTo(IJavaClassMethod o)
- Specified by:
compareTo
in interfaceComparable<IJavaClassMethod>
-
-