std.reflect
Function Description
The reflect package provides reflection functionality, allowing the program to obtain the type information of various instances at runtime and perform various read, write, and call operations.
This package currently does not work on macOS.
NOTE
- For global information, the reflection functionality of Cangjie only supports accessing
publicglobal variables and global functions.- For the current package, the reflection functionality of Cangjie supports accessing all globally defined types. For externally imported packages or dynamically loaded modules, only the globally defined
publictypes can be accessed.- For member information, the reflection functionality of Cangjie only supports accessing
publicmembers (instances/static variables/properties/functions) in the type. Members with non-publicmodifiers or default modifiers are invisible.- Currently, the reflection functionality of Cangjie does not support the function type, tuple type, and
enumtype.
API
Function
| Name | Description |
|---|---|
| parseParameterTypes(String) | Converts a string into a function signature that contains specific type information for use by functions such as getStaticFunction. |
Type Alias
| Name | Description |
|---|---|
| Annotation | Specifies the alias of the object class. |
Class
| Name | Description |
|---|---|
| ClassTypeInfo | Describes type information of the class type. |
| ConstructorInfo | Describes constructor information. |
| GenericTypeInfo | Describes generic type information. |
| GlobalFunctionInfo | Describes global function information. |
| GlobalVariableInfo | Describes global variable information. |
| InstanceFunctionInfo | Describes instance function information. |
| InstancePropertyInfo | Describes instance property information. |
| InstanceVariableInfo | Describes instance variable information. |
| InterfaceTypeInfo | Describes type information of the interface type. |
| PackageInfo | Describes package information. |
| ParameterInfo | Describes function parameter information. |
| PrimitiveTypeInfo | Describes type information of a primitive data type. |
| StaticFunctionInfo | Describes static function information. |
| StaticPropertyInfo | Describes static property information. |
| StaticVariableInfo | Describes static variable information. |
| StructTypeInfo | Describes type information of the struct type. |
| TypeInfo | Provides a common interface for operations on all data types and allows users to perform reflection operations. |
Enumeration
| Name | Description |
|---|---|
| ModifierInfo | Describes information about modifiers. |
Exception
| Name | Description |
|---|---|
| IllegalSetException | Indicates an exception thrown upon an attempt to modify an immutable type. |
| IllegalTypeException | Indicates a type mismatch exception. |
| InfoNotFoundException | Indicates that the corresponding information cannot be found. |
| InvocationTargetException | Indication an exception that wraps a function invocation exception. |
| MisMatchException | Indicates an exception thrown when the corresponding function is called incorrectly. |
| ReflectException | Specifies the base exception class for the Reflect package. |