clojure.reflect
(source)Reflection on Host Types
Alpha - subject to change.
Two main entry points:
* type-reflect reflects on something that implements TypeReference.
* reflect (for REPL use) reflects on the class of an instance, or
on a class if passed a class
Key features:
* Exposes the read side of reflection as pure data. Reflecting
on a type returns a map with keys :bases, :flags, and :members.
* Canonicalizes class names as Clojure symbols. Types can extend
to the TypeReference protocol to indicate that they can be
unambiguously resolved as a type name. The canonical format
requires one non-Java-ish convention: array brackets are <>
instead of [] so they can be part of a Clojure symbol.
* Pluggable Reflectors for different implementations. The default
JavaReflector is good when you have a class in hand, or use
the AsmReflector for "hands off" reflection without forcing
classes to load.
Platform implementers must:
* Create an implementation of Reflector.
* Create one or more implementations of TypeReference.
* def default-reflector to be an instance that satisfies Reflector.
| Public Variable | Short Description |
|---|---|
| ->AsmReflector (clj) | |
| ->Constructor (clj) | |
| ->Field (clj) | |
| ->JavaReflector (clj) | |
| ->Method (clj) | |
| AsmReflector (clj) | |
| ClassResolver (clj) | |
| Constructor (clj) | |
| Field (clj) | |
| JavaReflector (clj) | |
| Method (clj) | |
| Reflector (clj) | Protocol for reflection implementers. |
| TypeReference (clj) | A TypeReference can be unambiguously converted to a type name on the host platform. |
| default-reflector (clj) | |
| do-reflect (clj) | |
| flag-descriptors (clj) | The Java access bitflags, along with their friendly names and the kinds of objects to which they can apply. |
| map->Constructor (clj) | |
| map->Field (clj) | |
| map->Method (clj) | |
| reflect (clj) | Alpha - subject to change. |
| resolve-class (clj) | Given a class name, return that typeref's class bytes as an InputStream. |
| type-reflect (clj) | Alpha - subject to change. |
| typename (clj) | Returns Java name as returned by ASM getClassName, e.g. |