Package gw.internal.gosu.parser
Class GosuClassTypeInfo
- java.lang.Object
-
- gw.lang.reflect.BaseFeatureInfo
-
- gw.lang.reflect.BaseTypeInfo
-
- gw.internal.gosu.parser.GosuClassTypeInfo
-
- All Implemented Interfaces:
IGosuClassTypeInfo,IAnnotatedFeatureInfo,IAttributedFeatureInfo,IFeatureInfo,IRelativeTypeInfo,ITypeInfo
public class GosuClassTypeInfo extends BaseTypeInfo implements IGosuClassTypeInfo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classGosuClassTypeInfo.MyFeatureManager-
Nested classes/interfaces inherited from interface gw.lang.reflect.IAnnotatedFeatureInfo
IAnnotatedFeatureInfo.IAnnotationInfoHelper
-
Nested classes/interfaces inherited from interface gw.lang.reflect.IAttributedFeatureInfo
IAttributedFeatureInfo.MODIFIER
-
Nested classes/interfaces inherited from interface gw.lang.reflect.IRelativeTypeInfo
IRelativeTypeInfo.Accessibility
-
Nested classes/interfaces inherited from interface gw.lang.reflect.ITypeInfo
ITypeInfo.FIND
-
-
Field Summary
Fields Modifier and Type Field Description private LockingLazyVar<java.util.List<IAnnotationInfo>>_declaredAnnotationsprivate java.util.ArrayList_declaredConstructorsprivate java.util.ArrayList<IGosuMethodInfo>_declaredMethodsprivate java.util.List<IPropertyInfo>_declaredPropertiesprivate GosuClassTypeInfo.MyFeatureManager_fmprivate IGosuClassInternal_gsClassprivate java.util.Map<GosuBaseAttributedFeatureInfo,IModifierInfo>_modifierInfoByFeatureprivate static java.lang.ThreadLocal<java.util.List<java.lang.Boolean>>INCLUDE_ALL-
Fields inherited from interface gw.lang.reflect.IAnnotatedFeatureInfo
ANNOTATION_HELPER
-
Fields inherited from interface gw.lang.reflect.IRelativeTypeInfo
Accessibility_Size
-
Fields inherited from interface gw.lang.reflect.ITypeInfo
TYPEINFO_EXT
-
-
Constructor Summary
Constructors Constructor Description GosuClassTypeInfo(IGosuClassInternal gsClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddDefinedProperties(java.util.List<IPropertyInfo> declaredPropertiesMap, java.util.List<DynamicPropertySymbol> propertySymbols)private java.util.ListcreateConstructorInfos(java.util.List<DynamicFunctionSymbol> functions)private java.util.List<IGosuMethodInfo>createMethodInfos(java.util.List mapFunctions)private voidextractConstructors()private voidextractMethods()private voidextractProperties()voidforceInit()IRelativeTypeInfo.AccessibilitygetAccessibilityForType(IType whosaskin)IConstructorInfogetCallableConstructor(IType... params)Returns a IConstructorInfo matching the specified parameter types or null if no match is found.IMethodInfogetCallableMethod(java.lang.CharSequence strMethod, IType... params)Returns a IMethodInfo matching the specified name and has parameter types that produce the best match.private ITypegetCompilingClass()We expose type info in a context sensitive manner.IConstructorInfogetConstructor(IType... params)Returns a IConstructorInfo that has parameter types that produce the best match.IConstructorInfogetConstructor(IType whosAskin, IType[] params)java.util.List<GosuConstructorInfo>getConstructors()java.util.List<GosuConstructorInfo>getConstructors(IType whosAskin)java.util.List<IAnnotationInfo>getDeclaredAnnotations()java.util.List<? extends IConstructorInfo>getDeclaredConstructors()Returns a list ofIConstructorInfoobjects reflecting all the constructors declared by the class represented by thisITypeobject.java.util.List<? extends IMethodInfo>getDeclaredMethods()Returns a list ofIMethodInfoobjects reflecting all the methods declared by the class or interface represented by thisITypeobject.java.util.List<? extends IPropertyInfo>getDeclaredProperties()Returns a list ofIPropertyInfoobjects reflecting all the properties declared by the class or interface represented by thisITypeobject.java.lang.StringgetDescription()A full description of this feature.IEventInfogetEvent(java.lang.CharSequence strEvent)Get an event mapped to the specified name.java.util.List<IEventInfo>getEvents()IGosuClassInternalgetGosuClass()IMethodInfogetMethod(IType whosaskin, java.lang.CharSequence methodName, IType... params)IMethodInfogetMethod(java.lang.CharSequence methodName, IType... params)Returns a IMethodInfo matching the specified name and parameter types or null if no match is found.MethodListgetMethods()MethodListgetMethods(IType whosAskin)IModifierInfogetModifierInfo(GosuBaseAttributedFeatureInfo featureInfo)java.lang.StringgetName()Gets the programmatic name or identifier of this feature.java.util.List<? extends IPropertyInfo>getProperties()java.util.List<IPropertyInfo>getProperties(IType whosAskin)IPropertyInfogetProperty(IType whosAskin, java.lang.CharSequence propName)IPropertyInfogetProperty(java.lang.CharSequence propName)Get a property mapped to the specified name.booleanisDeprecated()static booleanisIncludeAll()booleanisInternal()True if this feature is internal.booleanisPrivate()True if this feature is private.booleanisProtected()True if this feature is protected.booleanisPublic()True if this feature is public.booleanisStatic()True if this feature is static, meaning the feature is not specific to a particular instance of the feature's containing type.private voidmakePropertiesFromFields(java.util.List<IPropertyInfo> declaredPropertiesMap, java.util.Collection<IVarStatement> fields)private voidmakePropertiesFromGenericTypesFields(java.util.List<IPropertyInfo> declaredPropertiesMap)private IConstructorInfomakeStandardAnnotationConstructor()static voidpopIncludeAll()static voidpushIncludeAll()voidsetModifierInfo(GosuBaseAttributedFeatureInfo featureInfo, IModifierInfo modifierInfo)java.lang.StringtoString()voidunload()-
Methods inherited from class gw.lang.reflect.BaseFeatureInfo
getAnnotation, getAnnotations, getAnnotationsOfType, getContainer, getDeprecatedReason, getDisplayName, getOwnersType, getParamTypes, getSuperAnnotatedElements, hasAnnotation, hasDeclaredAnnotation, isAbstract, isDefaultImpl, isFinal, isHidden, isInternalAPI, isReified, isScriptable, isVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.lang.reflect.IAnnotatedFeatureInfo
getAnnotation, getAnnotations, getAnnotationsOfType, getDeprecatedReason, hasAnnotation, hasDeclaredAnnotation, isDefaultImpl
-
Methods inherited from interface gw.lang.reflect.IAttributedFeatureInfo
isAbstract, isFinal, isHidden, isReified, isScriptable, isVisible
-
Methods inherited from interface gw.lang.reflect.IFeatureInfo
getContainer, getDisplayName, getLocationInfo, getOwnersType
-
-
-
-
Field Detail
-
INCLUDE_ALL
private static final java.lang.ThreadLocal<java.util.List<java.lang.Boolean>> INCLUDE_ALL
-
_gsClass
private IGosuClassInternal _gsClass
-
_declaredMethods
private java.util.ArrayList<IGosuMethodInfo> _declaredMethods
-
_declaredProperties
private java.util.List<IPropertyInfo> _declaredProperties
-
_declaredConstructors
private java.util.ArrayList _declaredConstructors
-
_declaredAnnotations
private LockingLazyVar<java.util.List<IAnnotationInfo>> _declaredAnnotations
-
_modifierInfoByFeature
private java.util.Map<GosuBaseAttributedFeatureInfo,IModifierInfo> _modifierInfoByFeature
-
_fm
private GosuClassTypeInfo.MyFeatureManager _fm
-
-
Constructor Detail
-
GosuClassTypeInfo
public GosuClassTypeInfo(IGosuClassInternal gsClass)
-
-
Method Detail
-
pushIncludeAll
public static void pushIncludeAll()
-
popIncludeAll
public static void popIncludeAll()
-
isIncludeAll
public static boolean isIncludeAll()
-
forceInit
public void forceInit()
-
isStatic
public boolean isStatic()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is static, meaning the feature is not specific to a particular instance of the feature's containing type.- Specified by:
isStaticin interfaceIAttributedFeatureInfo- Overrides:
isStaticin classBaseTypeInfo
-
isPrivate
public boolean isPrivate()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is private. Private features are only accessible from within the type that owns them.- Specified by:
isPrivatein interfaceIAttributedFeatureInfo- Overrides:
isPrivatein classBaseFeatureInfo
-
isInternal
public boolean isInternal()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is internal. Internal features are accessible from within the type that owns them and from other types in the same namespace.- Specified by:
isInternalin interfaceIAttributedFeatureInfo- Overrides:
isInternalin classBaseFeatureInfo
-
isProtected
public boolean isProtected()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is protected. Protected features are accessible from within the type that owns them and from derived containers.- Specified by:
isProtectedin interfaceIAttributedFeatureInfo- Overrides:
isProtectedin classBaseFeatureInfo
-
isPublic
public boolean isPublic()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is public. Public features are not restricted.- Specified by:
isPublicin interfaceIAttributedFeatureInfo- Overrides:
isPublicin classBaseFeatureInfo
-
isDeprecated
public boolean isDeprecated()
- Specified by:
isDeprecatedin interfaceIAnnotatedFeatureInfo- Overrides:
isDeprecatedin classBaseFeatureInfo- Returns:
- True if this feature is deprecated.
-
getDeclaredAnnotations
public java.util.List<IAnnotationInfo> getDeclaredAnnotations()
- Specified by:
getDeclaredAnnotationsin interfaceIAnnotatedFeatureInfo- Overrides:
getDeclaredAnnotationsin classBaseTypeInfo- Returns:
- A map of AnnotationInfo objects by type representing all the annotations associated with this feature, or an empty map if there are no annotations.
-
getDeclaredMethods
public java.util.List<? extends IMethodInfo> getDeclaredMethods()
Description copied from interface:IRelativeTypeInfoReturns a list ofIMethodInfoobjects reflecting all the methods declared by the class or interface represented by thisITypeobject. This includes public, protected, internal access, and private methods, but excludes inherited methods. The elements in the list are ordered by declaration order in the file. This method returns an empty list if the type does not contain any methods- Specified by:
getDeclaredMethodsin interfaceIRelativeTypeInfo- Returns:
- the list of
IMethodInfoobjects representing all the declared methods of this class
-
getDeclaredProperties
public java.util.List<? extends IPropertyInfo> getDeclaredProperties()
Description copied from interface:IRelativeTypeInfoReturns a list ofIPropertyInfoobjects reflecting all the properties declared by the class or interface represented by thisITypeobject. This includes public, protected, internal access, and private properties, but excludes inherited properties. The elements in the list are ordered by declaration order in the file. This method returns an empty list if the type does not contain any properties- Specified by:
getDeclaredPropertiesin interfaceIRelativeTypeInfo- Returns:
- the list of
IPropertyInfoobjects representing all the declared properties of this class
-
getDeclaredConstructors
public java.util.List<? extends IConstructorInfo> getDeclaredConstructors()
Description copied from interface:IRelativeTypeInfoReturns a list ofIConstructorInfoobjects reflecting all the constructors declared by the class represented by thisITypeobject. This includes public, protected, internal access, and private constructors. Interfaces and arrays always return an empty list. The elements in the list are ordered by declaration order in the file. This method returns an empty list if the type does not contain any methods- Specified by:
getDeclaredConstructorsin interfaceIRelativeTypeInfo- Returns:
- the list of
IConstructorInfoobjects representing all the declared methods of this class
-
getName
public java.lang.String getName()
Description copied from interface:IFeatureInfoGets the programmatic name or identifier of this feature. Note this name should follow Java identifier naming conventions (alpha-num and underscores, but can't start with a digit).- Specified by:
getNamein interfaceIFeatureInfo- Overrides:
getNamein classBaseTypeInfo
-
getAccessibilityForType
public IRelativeTypeInfo.Accessibility getAccessibilityForType(IType whosaskin)
- Specified by:
getAccessibilityForTypein interfaceIRelativeTypeInfo
-
getProperties
public java.util.List<? extends IPropertyInfo> getProperties()
- Specified by:
getPropertiesin interfaceITypeInfo- Overrides:
getPropertiesin classBaseTypeInfo- Returns:
- An unmodifiable random access list of
IPropertyInfoinstances. The list is sorted ascending by name. Returns an empty list if there are no properties.
-
getProperties
public java.util.List<IPropertyInfo> getProperties(IType whosAskin)
- Specified by:
getPropertiesin interfaceIRelativeTypeInfo
-
getProperty
public IPropertyInfo getProperty(java.lang.CharSequence propName)
Description copied from interface:ITypeInfoGet a property mapped to the specified name.- Specified by:
getPropertyin interfaceITypeInfo- Overrides:
getPropertyin classBaseTypeInfo- Parameters:
propName- The property name.- Returns:
- An IPropertyInfo corresponding to the property name.
-
getProperty
public IPropertyInfo getProperty(IType whosAskin, java.lang.CharSequence propName)
- Specified by:
getPropertyin interfaceIRelativeTypeInfo
-
getMethods
public MethodList getMethods()
- Specified by:
getMethodsin interfaceITypeInfo- Overrides:
getMethodsin classBaseTypeInfo- Returns:
- An unmodifiable random access list of
IMethodInfoinstances. The list is sorted ascending by name. Returns an empty list if there are no methods.
-
getMethods
public MethodList getMethods(IType whosAskin)
- Specified by:
getMethodsin interfaceIRelativeTypeInfo
-
getConstructors
public java.util.List<GosuConstructorInfo> getConstructors()
- Specified by:
getConstructorsin interfaceITypeInfo- Overrides:
getConstructorsin classBaseTypeInfo- Returns:
- An unmodifiable random access list of
IConstructorInfoinstances. The list is sorted ascending by name. Returns an empty list if there are no constructors.
-
getConstructors
public java.util.List<GosuConstructorInfo> getConstructors(IType whosAskin)
- Specified by:
getConstructorsin interfaceIRelativeTypeInfo
-
getMethod
public IMethodInfo getMethod(java.lang.CharSequence methodName, IType... params)
Description copied from interface:ITypeInfoReturns a IMethodInfo matching the specified name and parameter types or null if no match is found. Noteparamsmust exactly match those of the target method in number, order, and type. If null,paramsis treated as an empty array.- Specified by:
getMethodin interfaceITypeInfo- Overrides:
getMethodin classBaseTypeInfo- Parameters:
methodName- The name of the method to find.params- Represents the exact number, order, and type of parameters in the method. A null value here is treated as an empty array.- Returns:
- A IMethodInfo matching the name and parameter types.
-
getMethod
public IMethodInfo getMethod(IType whosaskin, java.lang.CharSequence methodName, IType... params)
- Specified by:
getMethodin interfaceIRelativeTypeInfo
-
getConstructor
public IConstructorInfo getConstructor(IType... params)
Description copied from interface:ITypeInfoReturns a IConstructorInfo that has parameter types that produce the best match. If there is a tie with method names then this will throw an illegal argument exception.- Specified by:
getConstructorin interfaceITypeInfo- Overrides:
getConstructorin classBaseTypeInfo- Parameters:
params- Represents the exact number, order, and type of parameters in the constructor. A null value here is treated as an empty array.- Returns:
- A IConstructorInfo matching the parameter types.
-
getConstructor
public IConstructorInfo getConstructor(IType whosAskin, IType[] params)
- Specified by:
getConstructorin interfaceIRelativeTypeInfo
-
getCallableMethod
public IMethodInfo getCallableMethod(java.lang.CharSequence strMethod, IType... params)
Description copied from interface:ITypeInfoReturns a IMethodInfo matching the specified name and has parameter types that produce the best match. If there is a tie with method names then this will throw an illegal argument exception.- Specified by:
getCallableMethodin interfaceITypeInfo- Overrides:
getCallableMethodin classBaseTypeInfo- Parameters:
strMethod- The name of the method to find.params- Represents the exact number, order, and type of parameters in the method. A null value here is treated as an empty array.- Returns:
- A IMethodInfo matching the name and parameter types.
-
getCallableConstructor
public IConstructorInfo getCallableConstructor(IType... params)
Description copied from interface:ITypeInfoReturns a IConstructorInfo matching the specified parameter types or null if no match is found.- Specified by:
getCallableConstructorin interfaceITypeInfo- Overrides:
getCallableConstructorin classBaseTypeInfo- Parameters:
params- Represents the exact number, order, and type of parameters in the constructor. A null value here is treated as an empty array.- Returns:
- A IConstructorInfo matching the parameter types.
-
getEvents
public java.util.List<IEventInfo> getEvents()
- Specified by:
getEventsin interfaceITypeInfo- Overrides:
getEventsin classBaseTypeInfo- Returns:
- An unmodifiable random access list of
IEventInfoinstances. The list is sorted ascending by name. Returns an empty list if ther are no events.
-
getEvent
public IEventInfo getEvent(java.lang.CharSequence strEvent)
Description copied from interface:ITypeInfoGet an event mapped to the specified name.- Specified by:
getEventin interfaceITypeInfo- Overrides:
getEventin classBaseTypeInfo- Parameters:
strEvent- The event name.- Returns:
- An IEventInfo corresponding to the event name.
-
getGosuClass
public IGosuClassInternal getGosuClass()
- Specified by:
getGosuClassin interfaceIGosuClassTypeInfo
-
getCompilingClass
private IType getCompilingClass()
We expose type info in a context sensitive manner. For instance, we only expose private features from within the containing class. We can determine the context class from the current compiling class. The compiling class is obtained from either 1) the actual CompiledGosuClass stack the Gosu Class TypeLoader manages or 2) from the class itself if it's not compiled yet. Note the latter case happens only on the UI side when a class is being edited.
-
extractProperties
private void extractProperties()
-
makePropertiesFromGenericTypesFields
private void makePropertiesFromGenericTypesFields(java.util.List<IPropertyInfo> declaredPropertiesMap)
-
makePropertiesFromFields
private void makePropertiesFromFields(java.util.List<IPropertyInfo> declaredPropertiesMap, java.util.Collection<IVarStatement> fields)
-
addDefinedProperties
private void addDefinedProperties(java.util.List<IPropertyInfo> declaredPropertiesMap, java.util.List<DynamicPropertySymbol> propertySymbols)
-
extractMethods
private void extractMethods()
-
createMethodInfos
private java.util.List<IGosuMethodInfo> createMethodInfos(java.util.List mapFunctions)
-
extractConstructors
private void extractConstructors()
-
makeStandardAnnotationConstructor
private IConstructorInfo makeStandardAnnotationConstructor()
-
createConstructorInfos
private java.util.List createConstructorInfos(java.util.List<DynamicFunctionSymbol> functions)
-
unload
public void unload()
-
getDescription
public java.lang.String getDescription()
Description copied from interface:IFeatureInfoA full description of this feature.- Specified by:
getDescriptionin interfaceIFeatureInfo- Overrides:
getDescriptionin classBaseFeatureInfo
-
getModifierInfo
public IModifierInfo getModifierInfo(GosuBaseAttributedFeatureInfo featureInfo)
-
setModifierInfo
public void setModifierInfo(GosuBaseAttributedFeatureInfo featureInfo, IModifierInfo modifierInfo)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classBaseFeatureInfo
-
-