Class JavaSourceType
- java.lang.Object
-
- gw.lang.reflect.java.JavaSourceElement
-
- gw.lang.reflect.java.AbstractJavaClassInfo
-
- gw.internal.gosu.parser.java.classinfo.JavaSourceType
-
- All Implemented Interfaces:
IJavaAnnotatedElement
,IJavaClassInfo
,IJavaClassType
,ITypeInfoResolver
,Serializable
- Direct Known Subclasses:
JavaSourceAnnotation
,JavaSourceClass
,JavaSourceEnum
,JavaSourceInterface
public abstract class JavaSourceType extends AbstractJavaClassInfo implements ITypeInfoResolver
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface gw.lang.reflect.java.IJavaClassInfo
IJavaClassInfo.Util
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Object>
_cache
protected IJavaClassConstructor[]
_constructors
protected JavaSourceType
_enclosingClass
protected IJavaClassField[]
_fields
protected String
_fullyQualifiedName
protected IJavaClassType[]
_genericInterfaces
protected IJavaClassType
_genericSuperClass
protected IModule
_gosuModule
protected List<String>
_importList
protected IJavaClassInfo[]
_innerClasses
protected IJavaClassInfo[]
_interfaces
protected IJavaClassMethod[]
_methods
protected JavaSourceModifierList
_modifiersList
protected String
_namespace
protected String
_simpleName
protected IJavaClassTypeVariable[]
_typeParameters
static int
IGNORE_INTERFACES
static int
IGNORE_NONE
static int
IGNORE_SUPERCLASS
-
Fields inherited from interface gw.lang.reflect.java.IJavaClassInfo
LOCK
-
Fields inherited from interface gw.lang.reflect.java.IJavaClassType
EMPTY_ARRAY, ERROR_TYPE, NULL_TYPE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JavaSourceType(com.sun.source.tree.ClassTree typeDecl, JavaSourceType enclosingClass)
For inner classes.protected
JavaSourceType(ISourceFileHandle fileHandle, com.sun.source.tree.CompilationUnitTree compilationUnitTree, com.sun.source.tree.ClassTree typeDecl, List<? extends com.sun.source.tree.ImportTree> imports, com.sun.source.util.SourcePositions sourcePositions, IModule gosuModule)
For top level classes.
-
Method Summary
-
Methods inherited from class gw.lang.reflect.java.AbstractJavaClassInfo
equals, equals, hashCode, hashCode, isAssignableFrom, isAssignableFrom
-
Methods inherited from class gw.lang.reflect.java.JavaSourceElement
findInnerSourceType, getLocationInfo
-
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
-
Methods inherited from interface gw.lang.reflect.java.IJavaClassInfo
getDeclaredField, getField
-
Methods inherited from interface gw.lang.reflect.java.IJavaClassType
isAssignableFrom
-
-
-
-
Field Detail
-
IGNORE_NONE
public static final int IGNORE_NONE
- See Also:
- Constant Field Values
-
IGNORE_INTERFACES
public static final int IGNORE_INTERFACES
- See Also:
- Constant Field Values
-
IGNORE_SUPERCLASS
public static final int IGNORE_SUPERCLASS
- See Also:
- Constant Field Values
-
_gosuModule
protected IModule _gosuModule
-
_fullyQualifiedName
protected String _fullyQualifiedName
-
_namespace
protected String _namespace
-
_simpleName
protected String _simpleName
-
_enclosingClass
protected JavaSourceType _enclosingClass
-
_fields
protected IJavaClassField[] _fields
-
_methods
protected IJavaClassMethod[] _methods
-
_modifiersList
protected JavaSourceModifierList _modifiersList
-
_innerClasses
protected IJavaClassInfo[] _innerClasses
-
_constructors
protected IJavaClassConstructor[] _constructors
-
_interfaces
protected IJavaClassInfo[] _interfaces
-
_genericSuperClass
protected IJavaClassType _genericSuperClass
-
_typeParameters
protected IJavaClassTypeVariable[] _typeParameters
-
_genericInterfaces
protected IJavaClassType[] _genericInterfaces
-
-
Constructor Detail
-
JavaSourceType
protected JavaSourceType(ISourceFileHandle fileHandle, com.sun.source.tree.CompilationUnitTree compilationUnitTree, com.sun.source.tree.ClassTree typeDecl, List<? extends com.sun.source.tree.ImportTree> imports, com.sun.source.util.SourcePositions sourcePositions, IModule gosuModule)
For top level classes.
-
JavaSourceType
protected JavaSourceType(com.sun.source.tree.ClassTree typeDecl, JavaSourceType enclosingClass)
For inner classes.
-
-
Method Detail
-
createTopLevel
public static IJavaClassInfo createTopLevel(ISourceFileHandle fileHandle, IModule gosuModule)
-
createTopLevel
public static IJavaClassInfo createTopLevel(ISourceFileHandle fileHandle, IModule gosuModule, DiagnosticCollector<JavaFileObject> errorHandler)
-
createType
public static IJavaClassType createType(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree tree)
-
createType
public static IJavaClassType createType(ITypeInfoResolver typeResolver, String typeName, int ignoreFlags)
-
makeImportList
protected void makeImportList(List<? extends com.sun.source.tree.ImportTree> imports)
-
getModule
public IModule getModule()
- Specified by:
getModule
in interfaceIJavaClassType
- Specified by:
getModule
in interfaceITypeInfoResolver
-
getNameSignature
public String getNameSignature()
- Specified by:
getNameSignature
in interfaceIJavaClassInfo
-
getRelativeName
public String getRelativeName()
- Specified by:
getRelativeName
in interfaceIJavaClassInfo
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceIJavaClassInfo
-
getSimpleName
public String getSimpleName()
- Specified by:
getSimpleName
in interfaceIJavaClassType
-
isArray
public boolean isArray()
- Specified by:
isArray
in interfaceIJavaClassInfo
- Specified by:
isArray
in interfaceIJavaClassType
-
getName
public String getName()
- Specified by:
getName
in interfaceIJavaClassType
-
getInterfaces
public IJavaClassInfo[] getInterfaces()
- Specified by:
getInterfaces
in interfaceIJavaClassInfo
-
getTypeName
public static String getTypeName(com.sun.source.tree.Tree tree)
-
getGenericInterfaces
public IJavaClassType[] getGenericInterfaces()
- Specified by:
getGenericInterfaces
in interfaceIJavaClassInfo
-
getSuperclass
public IJavaClassInfo getSuperclass()
- Specified by:
getSuperclass
in interfaceIJavaClassInfo
-
getGenericSuperclass
public IJavaClassType getGenericSuperclass()
- Specified by:
getGenericSuperclass
in interfaceIJavaClassInfo
-
initMethodsAndConstructors
public void initMethodsAndConstructors()
-
getDeclaredMethods
public IJavaClassMethod[] getDeclaredMethods()
- Specified by:
getDeclaredMethods
in interfaceIJavaClassInfo
-
getDeclaredConstructors
public IJavaClassConstructor[] getDeclaredConstructors()
- Specified by:
getDeclaredConstructors
in interfaceIJavaClassInfo
-
getConstructor
public IJavaClassConstructor getConstructor(IJavaClassInfo... paramTypes) throws NoSuchMethodException
- Specified by:
getConstructor
in interfaceIJavaClassInfo
- Throws:
NoSuchMethodException
-
getDeclaredFields
public IJavaClassField[] getDeclaredFields()
- Specified by:
getDeclaredFields
in interfaceIJavaClassInfo
-
getFields
public IJavaClassField[] getFields()
- Specified by:
getFields
in interfaceIJavaClassInfo
-
getEnumConstants
public Object[] getEnumConstants()
- Specified by:
getEnumConstants
in interfaceIJavaClassInfo
-
getPropertyDescriptors
public IJavaPropertyDescriptor[] getPropertyDescriptors()
- Specified by:
getPropertyDescriptors
in interfaceIJavaClassInfo
-
getJavaType
public IType getJavaType()
- Specified by:
getJavaType
in interfaceIJavaClassInfo
-
setJavaType
public void setJavaType(IJavaType javaType)
-
getTypeParameters
public IJavaClassTypeVariable[] getTypeParameters()
- Specified by:
getTypeParameters
in interfaceIJavaClassInfo
-
createClassDocNode
public IClassDocNode createClassDocNode()
- Specified by:
createClassDocNode
in interfaceIJavaClassInfo
-
hasCustomBeanInfo
public boolean hasCustomBeanInfo()
- Specified by:
hasCustomBeanInfo
in interfaceIJavaClassInfo
-
isVisibleViaFeatureDescriptor
public boolean isVisibleViaFeatureDescriptor(IScriptabilityModifier constraint)
- Specified by:
isVisibleViaFeatureDescriptor
in interfaceIJavaClassInfo
-
isHiddenViaFeatureDescriptor
public boolean isHiddenViaFeatureDescriptor()
- Specified by:
isHiddenViaFeatureDescriptor
in interfaceIJavaClassInfo
-
getComponentType
public IJavaClassInfo getComponentType()
- Specified by:
getComponentType
in interfaceIJavaClassInfo
- Specified by:
getComponentType
in interfaceIJavaClassType
-
getModifiers
public int getModifiers()
- Specified by:
getModifiers
in interfaceIJavaClassInfo
-
getModifierList
public IModifierList getModifierList()
-
getEnclosingType
public IType getEnclosingType()
- Specified by:
getEnclosingType
in interfaceIJavaClassInfo
-
getNamespace
public String getNamespace()
- Specified by:
getNamespace
in interfaceIJavaClassType
-
getArrayType
public IJavaClassInfo getArrayType()
- Specified by:
getArrayType
in interfaceIJavaClassInfo
-
getDeclaredClasses
public IJavaClassInfo[] getDeclaredClasses()
- Specified by:
getDeclaredClasses
in interfaceIJavaClassInfo
-
getBackingClass
public Class getBackingClass()
- Specified by:
getBackingClass
in interfaceIJavaClassInfo
-
getInnerClass
public IJavaClassInfo getInnerClass(String relativeName)
-
getActualType
public IType getActualType(TypeVarToTypeMap typeMap)
- Specified by:
getActualType
in interfaceIJavaClassType
-
getActualType
public IType getActualType(TypeVarToTypeMap typeMap, boolean bKeepTypeVars)
- Specified by:
getActualType
in interfaceIJavaClassType
-
getConcreteType
public IJavaClassType getConcreteType()
- Specified by:
getConcreteType
in interfaceIJavaClassType
-
isClass
public boolean isClass()
-
isInterface
public boolean isInterface()
- Specified by:
isInterface
in interfaceIJavaClassInfo
-
newInstance
public Object newInstance() throws InstantiationException, IllegalAccessException
- Specified by:
newInstance
in interfaceIJavaClassInfo
- Throws:
InstantiationException
IllegalAccessException
-
getMethod
public IJavaClassMethod getMethod(String methodName, IJavaClassInfo... paramTypes) throws NoSuchMethodException
- Specified by:
getMethod
in interfaceIJavaClassInfo
- Throws:
NoSuchMethodException
-
getDeclaredMethod
public IJavaClassMethod getDeclaredMethod(String methodName, IJavaClassInfo... paramTypes) throws NoSuchMethodException
- Specified by:
getDeclaredMethod
in interfaceIJavaClassInfo
- Throws:
NoSuchMethodException
-
getMethodDescriptors
public IJavaMethodDescriptor[] getMethodDescriptors()
- Specified by:
getMethodDescriptors
in interfaceIJavaClassInfo
-
isEnum
public boolean isEnum()
- Specified by:
isEnum
in interfaceIJavaClassInfo
-
isPrimitive
public boolean isPrimitive()
- Specified by:
isPrimitive
in interfaceIJavaClassInfo
-
isAnnotation
public boolean isAnnotation()
- Specified by:
isAnnotation
in interfaceIJavaClassInfo
-
isPublic
public boolean isPublic()
- Specified by:
isPublic
in interfaceIJavaClassInfo
-
isProtected
public boolean isProtected()
- Specified by:
isProtected
in interfaceIJavaClassInfo
-
isPrivate
public boolean isPrivate()
- Specified by:
isPrivate
in interfaceIJavaClassInfo
-
isInternal
public boolean isInternal()
- Specified by:
isInternal
in interfaceIJavaClassInfo
-
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
-
getEnclosingClass
public IJavaClassInfo getEnclosingClass()
- Specified by:
getEnclosingClass
in interfaceIJavaAnnotatedElement
- Specified by:
getEnclosingClass
in classJavaSourceElement
-
getDeclaringClass
public IJavaClassInfo getDeclaringClass()
- Overrides:
getDeclaringClass
in classJavaSourceElement
-
getDeepestClassAtOffset
public JavaSourceType getDeepestClassAtOffset(int offset)
- Specified by:
getDeepestClassAtOffset
in interfaceIJavaClassInfo
-
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
-
getTypeUsesMap
public TypeUsesMap getTypeUsesMap()
-
getSourceFileHandle
public ISourceFileHandle getSourceFileHandle()
- Specified by:
getSourceFileHandle
in interfaceIJavaClassInfo
-
isCompilable
public boolean isCompilable()
- Specified by:
isCompilable
in interfaceIJavaClassInfo
-
compile
public byte[] compile()
- Specified by:
compile
in interfaceIJavaClassInfo
-
getTree
public com.sun.source.tree.ClassTree getTree()
- Specified by:
getTree
in classJavaSourceElement
-
getCompilationUnitTree
public com.sun.source.tree.CompilationUnitTree getCompilationUnitTree()
- Overrides:
getCompilationUnitTree
in classJavaSourceElement
-
getSourcePositions
public com.sun.source.util.SourcePositions getSourcePositions()
- Overrides:
getSourcePositions
in classJavaSourceElement
-
getStartPosition
public int getStartPosition()
- Overrides:
getStartPosition
in classJavaSourceElement
-
getEndPosition
public int getEndPosition()
- Overrides:
getEndPosition
in classJavaSourceElement
-
-