Package gw.lang.reflect
Class TypeSystem
java.lang.Object
gw.lang.reflect.TypeSystem
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Lockstatic InvocationCounterstatic InvocationCounter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidstatic ITypeboundTypes(IType targetType, List<IType> typesToBound) static IType[]boxPrimitiveTypeParams(IType[] typeParams) static booleanstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic ITypefindParameterizedType(IType type, IType rhsType) static ITypeget(IJavaClassInfo javaClassInfo) static ITypeget(IJavaClassInfo classInfo, IModule module) static ITypeGets the intrinsic type for a given class.static ITypestatic ITypegetActualType(IType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars) static List<ITypeLoader>static Set<? extends CharSequence>Returns all type names in the system for all type loaders.static ITypegetBoxType(IType primitiveType) static ITypegetByFullName(String fullyQualifiedName) Gets an intrinsic type based on a fully-qualified name.static ITypegetByFullName(String fullyQualifiedName, IModule module) static ITypegetByFullName(String fullyQualifiedName, String moduleName) Deprecated.call getByFullName( String, IModule )static ITypegetByFullNameIfValid(String fullyQualifiedName) Gets a type based on a fully-qualified name.static ITypegetByFullNameIfValid(String typeName, IModule module) static ITypegetByFullNameIfValidNoJava(String fullyQualifiedName) static ITypegetByRelativeName(String relativeName) static ITypegetByRelativeName(String relativeName, ITypeUsesMap typeUses) Gets an intrinsic type based on a relative name.static ISymbolTablestatic ITypegetCompilingType(String strName) static ITypegetComponentType(IType valueType) static ITypegetCompoundType(Set<IType> types) static ITypestatic IModulestatic Method[]getDeclaredMethods(Class cls) static ITypestatic ITypestatic IMetaTypestatic IDefaultTypeLoaderstatic ITypeUsesMapstatic IErrorTypestatic IErrorTypestatic IErrorTypegetErrorType(String strErrantName) static IExecutionEnvironmentstatic IExecutionEnvironmentgetExecutionEnvironment(IProject project) static ITypegetFromObject(Object object) Returns the intrinsic type for the given Object.static ITypegetFromObject(Object object, IModule module) static ITypestatic StringgetGenericName(IType type) static StringgetGenericName(IType type, boolean bRelative, boolean bRelativeBounds) static StringgetGenericRelativeName(IType type, boolean bRelativeBounds) static Lockstatic IModulestatic IGosuClassLoaderstatic IJavaClassInfogetJavaClassInfo(Class jClass) static IJavaClassInfogetJavaClassInfo(Class jClass, IModule module) static IJavaClassInfogetJavaClassInfo(String fullyQualifiedName, IModule module) static ITypegetJavaType(Class javaClass) Deprecated.static IModulestatic ITypestatic List<? extends IMethodInfo>getMethods(ITypeInfo beanInfo, IType ownersIntrinsicType) static IModulegetModuleFromType(IType type) static StringgetNameOfParams(IType[] paramTypes, boolean bRelative, boolean bWithEnclosingType) static INamespaceTypegetNamespace(String strFqNamespace) static INamespaceTypegetNamespace(String strType, IModule module) getNamespacesFromTypeNames(Set<? extends CharSequence> allTypeNames, Set<String> namespaces) static Stringstatic IFunctionTypestatic IFunctionTypegetOrCreateFunctionType(String strFunctionName, IType retType, IType[] paramTypes) static ITypeRefIMPORTANT: The only time you should call this method is: 1) within a class implementing IType, or 2) wrapping a call to a Type constructor, typically within a type loader e.g., TypeSystem.getOrCreateTypeReference( new MyVeryOwnType() ) Gets or creates a type ref for the specified type.static ITypeVariableTypegetOrCreateTypeVariableType(String strName, IType boundingType, IType enclosingType) static ITypegetPrimitiveType(IType boxType) static IJavaTypegetPrimitiveType(String name) static List<? extends IPropertyInfo>getProperties(ITypeInfo beanInfo, IType classSource) static IPropertyInfogetPropertyInfo(IType classBean, String strProperty, IFeatureFilter filter, IParserPart parserBase, IScriptabilityModifier scriptabilityConstraint) static <E extends IType>
EgetPureGenericType(E type) static intstatic intstatic TypeSystemStategetState()static ISymbolTablestatic ITypestatic ITypegetTypeFromJavaBasedType(IJavaBackedType javaType) static ITypegetTypeFromObject(Object obj) static <T extends ITypeLoader>
TgetTypeLoader(Class<? extends T> loaderClass) static <T extends ITypeLoader>
TgetTypeLoader(Class<? extends T> loaderClass, IModule module) static ITypeRefgetTypeReference(IType type) IMPORTANT: The only time you should call this method is: 1) wrapping a call to a Type constructor, typically within a type loader e.g., TypeSystem.getOrCreateTypeReference( new MyVeryOwnType() ) Do NOT call this when creating the type.static String[]getTypesForFile(IModule module, IFile file) static Stringstatic voidinferTypeVariableTypesFromGenParamTypeAndConcreteType(IType genParamType, IType argType, TypeVarToTypeMap map, boolean bReverse) static booleanisBeanType(IType typeSource) static booleanisBoxedTypeFor(IType primitiveType, IType boxedType) static booleanisBytecodeType(IType type) static booleanstatic booleanisExpandable(IType type) static booleanstatic booleanisNumericType(IType intrType) static booleanisParameterizedWith(IType type, ITypeVariableType... typeVar) static voidlock()Acquires the global type-system lockstatic TypeVarToTypeMapmapTypeByVarName(IType ownersType, IType declaringType) static ITypeConverts a String name of a type into an IType.static ITypeparseType(String typeString, ITypeUsesMap typeUsesMap) static ITypeparseType(String typeString, TypeVarToTypeMap actualParamByVarName) static ITypeparseType(String typeString, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) static ITypeLiteralExpressionparseTypeExpression(String typeString, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) static ITypeparseTypeLiteral(String typeName) Parses a type name such as Iterable<Claim>.static voidstatic voidstatic voidstatic voidstatic voidstatic voidpushCompilingType(IType type) static voidstatic voidstatic voidpushModule(IModule gosuModule) static voidstatic voidpushTypeLoader(IModule module, ITypeLoader loader) static voidrefresh(boolean bRefreshCaches) static voidRefresh just the specified type i.e., a gosu editor calls this on changesstatic voidstatic voidstatic voidrefreshedFiles(String[] filePaths) DO NOT USE OR DELETE.static voidremoveTypeLoader(Class<? extends ITypeLoader> loader) static voidremoveTypeLoaderListener(ITypeLoaderListener listener) static ITypereplaceTypeVariableTypeParametersWithBoundingTypes(IType type, IType enclosingType) static voidshutdown(IExecutionEnvironment execEnv) static voidunlock()Releases the global type-system lock
-
Field Details
-
GLOBAL_LOCK
-
tyeRequestCounter
-
tyeLoadingCounter
-
-
Constructor Details
-
TypeSystem
public TypeSystem()
-
-
Method Details
-
get
Gets the intrinsic type for a given class.
Note: you should use this method only if you do not have an Object of classjavaClassto get the type from. If you do have such an object, usegetFromObject(java.lang.Object)instead.- Parameters:
javaClass- the Class to convert to an intrinsic type- Returns:
- the IType that corresponds to that class
- See Also:
-
get
-
get
-
get
-
getFromObject
Returns the intrinsic type for the given Object.- Parameters:
object- the object to get an IType for- Returns:
- the IType for the object
- See Also:
-
getFromObject
-
getByRelativeName
- Throws:
ClassNotFoundException
-
getByRelativeName
public static IType getByRelativeName(String relativeName, ITypeUsesMap typeUses) throws ClassNotFoundException Gets an intrinsic type based on a relative name. This could either be the name of an entity, like "User", the name of a typekey, like "SystemPermission", or a class name, like "java.lang.String" (relative and fully qualified class names are the same as far as this factory is concerned). Names can have [] appended to them to create arrays, and multi-dimensional arrays are supported.- Parameters:
relativeName- the relative name of the typetypeUses- the map of used types to use when resolving- Returns:
- the corresponding IType
- Throws:
ClassNotFoundException- if the specified name doesn't correspond to any type
-
getByFullName
Gets an intrinsic type based on a fully-qualified name. This could either be the name of an entity, like "entity.User", the name of a typekey, like "typekey.SystemPermission", or a class name, like "java.lang.String". Names can have [] appended to them to create arrays, and multi-dimensional arrays are supported.- Parameters:
fullyQualifiedName- the fully qualified name of the type- Returns:
- the corresponding IType
- Throws:
RuntimeException- if the specified name doesn't correspond to any type
-
getByFullName
-
getByFullName
Deprecated.call getByFullName( String, IModule ) -
pushGlobalModule
public static void pushGlobalModule() -
popGlobalModule
public static void popGlobalModule() -
getByFullNameIfValid
Gets a type based on a fully-qualified name. This could either be the name of an entity, like "entity.User", the name of a typekey, like "typekey.SystemPermission", or a class name, like "java.lang.String". Names can have [] appended to them to create arrays, and multi-dimensional arrays are supported. This method behaves the same as getByFullName execept instead of throwing it returns null.- Parameters:
fullyQualifiedName- the fully qualified name of the type- Returns:
- the corresponding IType or null if the type does not exist
-
getByFullNameIfValidNoJava
-
getByFullNameIfValid
-
clearErrorTypes
public static void clearErrorTypes() -
getRefreshChecksum
public static int getRefreshChecksum() -
getSingleRefreshChecksum
public static int getSingleRefreshChecksum() -
parseType
Converts a String name of a type into an IType.- Parameters:
typeString- the type name to parse- Returns:
- the parsed type
- Throws:
IllegalArgumentException- if the type string doesn't correspond to any known IType
-
parseType
public static IType parseType(String typeString, ITypeUsesMap typeUsesMap) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
parseType
public static IType parseType(String typeString, TypeVarToTypeMap actualParamByVarName) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
parseType
public static IType parseType(String typeString, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
parseTypeExpression
public static ITypeLiteralExpression parseTypeExpression(String typeString, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) throws ParseResultsException - Throws:
ParseResultsException
-
lock
public static void lock()Acquires the global type-system lock -
unlock
public static void unlock()Releases the global type-system lock -
getGlobalLock
-
getComponentType
-
getNamespace
-
getNamespace
-
getAllTypeNames
Returns all type names in the system for all type loaders.- Returns:
- all type names in the system.
-
getOrCreateTypeVariableType
public static ITypeVariableType getOrCreateTypeVariableType(String strName, IType boundingType, IType enclosingType) -
getOrCreateFunctionType
-
getOrCreateFunctionType
public static IFunctionType getOrCreateFunctionType(String strFunctionName, IType retType, IType[] paramTypes) -
getPureGenericType
-
isBeanType
-
isNumericType
-
isBoxedTypeFor
-
mapTypeByVarName
-
getActualType
public static IType getActualType(IType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars) -
inferTypeVariableTypesFromGenParamTypeAndConcreteType
public static void inferTypeVariableTypesFromGenParamTypeAndConcreteType(IType genParamType, IType argType, TypeVarToTypeMap map, boolean bReverse) -
getErrorType
-
getErrorType
-
getErrorType
-
getDefaultTypeLoader
-
findParameterizedType
-
addTypeLoaderListenerAsWeakRef
-
getNamespacesFromTypeNames
-
pushTypeLoader
-
removeTypeLoader
-
getKeyType
-
pushIncludeAll
public static void pushIncludeAll() -
popIncludeAll
public static void popIncludeAll() -
isIncludeAll
public static boolean isIncludeAll() -
getDefaultTypeUsesMap
-
getCurrentCompilingType
-
getCompilingType
-
pushCompilingType
-
popCompilingType
public static void popCompilingType() -
getUnqualifiedClassName
-
pushSymTableCtx
-
popSymTableCtx
public static void popSymTableCtx() -
getSymTableCtx
-
getTypeLoader
-
getTypeLoader
public static <T extends ITypeLoader> T getTypeLoader(Class<? extends T> loaderClass, IModule module) -
getNameOfParams
-
getCompiledGosuClassSymbolTable
-
getAllTypeLoaders
-
getGenericRelativeName
-
getGenericName
-
getGenericName
-
getPropertyInfo
public static IPropertyInfo getPropertyInfo(IType classBean, String strProperty, IFeatureFilter filter, IParserPart parserBase, IScriptabilityModifier scriptabilityConstraint) throws ParseException - Throws:
ParseException
-
getProperties
-
getMethods
-
getJavaType
Deprecated. -
getNameWithQualifiedTypeVariables
-
getDefaultParameterizedType
-
getDefaultParameterizedTypeWithTypeVars
-
canCast
-
removeTypeLoaderListener
-
getPrimitiveType
-
getPrimitiveType
-
getBoxType
-
boxPrimitiveTypeParams
-
getExecutionEnvironment
-
getExecutionEnvironment
-
getCurrentModule
-
getOrCreateTypeReference
IMPORTANT: The only time you should call this method is: 1) within a class implementing IType, or 2) wrapping a call to a Type constructor, typically within a type loader e.g., TypeSystem.getOrCreateTypeReference( new MyVeryOwnType() ) Gets or creates a type ref for the specified type.- Parameters:
type- A raw or proxied type.- Returns:
- If the type is already a reference, returns the type as-is, otherwise creates and returns a new type ref.
-
getTypeReference
IMPORTANT: The only time you should call this method is: 1) wrapping a call to a Type constructor, typically within a type loader e.g., TypeSystem.getOrCreateTypeReference( new MyVeryOwnType() ) Do NOT call this when creating the type. Instead call getOrCreateTypeReference Gets or creates a type ref for the specified type. This method will NOT update the type reference in the proxy.- Parameters:
type- A raw or proxied type.- Returns:
- returns the already created type reference or throws if the ref does not exist
-
getTypeFromObject
-
parseTypeLiteral
Parses a type name such as Iterable<Claim>.- Parameters:
typeName- the name to parse- Returns:
- the type
-
isExpandable
-
boundTypes
-
getJavaClassInfo
-
getJavaClassInfo
-
getDeclaredMethods
-
isBytecodeType
-
getTypeFromJavaBackedType
-
getTypeFromJavaBasedType
-
getJavaClassInfo
-
getModuleFromType
-
pushModule
-
popModule
-
getGosuClassLoader
-
dumpGosuClassLoader
public static void dumpGosuClassLoader() -
getGlobalModule
-
getDefaultType
-
shutdown
-
addShutdownListener
-
getState
-
getTypesForFile
-
refresh
public static void refresh(boolean bRefreshCaches) -
refresh
-
refresh
Refresh just the specified type i.e., a gosu editor calls this on changes -
refreshedFiles
DO NOT USE OR DELETE. Called form the debugging process (IDE).- Parameters:
filePaths-
-
refreshed
-
deleted
-
deleted
-
created
-
created
-
isDeleted
-
replaceTypeVariableTypeParametersWithBoundingTypes
-
isParameterizedWith
-
getJreModule
-
getCompoundType
-
getFunctionalInterface
-