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 public global 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 public types can be accessed.
  • For member information, the reflection functionality of Cangjie only supports accessing public members (instances/static variables/properties/functions) in the type. Members with non-public modifiers or default modifiers are invisible.
  • Currently, the reflection functionality of Cangjie does not support the function type, tuple type, and enum type.

API

Function

NameDescription
parseParameterTypes(String)Converts a string into a function signature that contains specific type information for use by functions such as getStaticFunction.

Type Alias

NameDescription
AnnotationSpecifies the alias of the object class.

Class

NameDescription
ClassTypeInfoDescribes type information of the class type.
ConstructorInfoDescribes constructor information.
GenericTypeInfoDescribes generic type information.
GlobalFunctionInfoDescribes global function information.
GlobalVariableInfoDescribes global variable information.
InstanceFunctionInfoDescribes instance function information.
InstancePropertyInfoDescribes instance property information.
InstanceVariableInfoDescribes instance variable information.
InterfaceTypeInfoDescribes type information of the interface type.
PackageInfoDescribes package information.
ParameterInfoDescribes function parameter information.
PrimitiveTypeInfoDescribes type information of a primitive data type.
StaticFunctionInfoDescribes static function information.
StaticPropertyInfoDescribes static property information.
StaticVariableInfoDescribes static variable information.
StructTypeInfoDescribes type information of the struct type.
TypeInfoProvides a common interface for operations on all data types and allows users to perform reflection operations.

Enumeration

NameDescription
ModifierInfoDescribes information about modifiers.

Exception

NameDescription
IllegalSetExceptionIndicates an exception thrown upon an attempt to modify an immutable type.
IllegalTypeExceptionIndicates a type mismatch exception.
InfoNotFoundExceptionIndicates that the corresponding information cannot be found.
InvocationTargetExceptionIndication an exception that wraps a function invocation exception.
MisMatchExceptionIndicates an exception thrown when the corresponding function is called incorrectly.
ReflectExceptionSpecifies the base exception class for the Reflect package.