std.reflect Package
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 can access only public global variables and global functions.
- For the current package, the reflection functionality of Cangjie can access all globally defined types. For externally imported packages or dynamically loaded modules, it can access only the publicly defined global types within them.
- For member information, the reflection functionality of Cangjie can access only public members (instances/static member variables/attributes/functions) within the type. Members that are decorated with non-
public
modifiers or default modifiers are invisible.- Currently, the reflection functionality of Cangjie does not support
Nothing
types, function types, tuple types,enum
types, or genericstruct
types.
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 . |
Class
Name | Description |
---|---|
TypeInfo | Provides a common interface for operations on all data types and allows users to perform reflection operations. |
ClassTypeInfo | Describes information about the class type. |
InterfaceTypeInfo | Describes information about the interface type. |
PrimitiveTypeInfo | Describes information about the primitive data type. |
StructTypeInfo | Describes information about the struct type. |
InfoList | An information list used to store read-only reflection information. |
ConstructorInfo | Describes constructor functions. |
ParameterInfo | Describes function parameters. |
InstanceFunctionInfo | Describes instance member functions. |
StaticFunctionInfo | Describes static member functions. |
InstancePropertyInfo | Describes instance member properties. |
StaticPropertyInfo | Describes static member properties. |
InstanceVariableInfo | Describes instance member variables. |
StaticVariableInfo | Describes static member variables. |
ModuleInfo | Describes module information, providing the ability for Cangjie dynamic module loading, caching, and querying package information within the module. |
PackageInfo | Describes package information. |
GlobalFunctionInfo | Describes global functions. |
GlobalVariableInfo | Describes global variables. |
Enumeration
Name | Description |
---|---|
ModifierInfo | Describes information about modifiers. |
Exception
Name | Description |
---|---|
ReflectException | Specifies the base exception class for the Reflect package. |
InfoNotFoundException | Indicates that the corresponding information cannot be found. |
MisMatchException | Indicates an exception thrown when the corresponding function is called incorrectly. |
IllegalSetException | Indicates an exception thrown upon an attempt to modify an immutable type. |
IllegalTypeException | Indicates a type mismatch exception. |
InvocationTargetException | Indication an exception that wraps a function invocation exception. |