ClassMirror abstract class
A ClassMirror reflects a Dart language class.
abstract class ClassMirror implements TypeMirror, ObjectMirror { /** * A mirror on the superclass on the reflectee. * * If this type is [:Object:] or a typedef, the superClass will be * null. */ ClassMirror get superclass; /** * A list of mirrors on the superinterfaces of the reflectee. */ List<ClassMirror> get superinterfaces; /** * An immutable map from from names to mirrors for all members of * this type. * * The members of a type are its methods, fields, getters, and * setters. Note that constructors and type variables are not * considered to be members of a type. * * This does not include inherited members. */ Map<String, Mirror> get members; /** * An immutable map from names to mirrors for all method, * declarations for this type. This does not include getters and * setters. */ Map<String, MethodMirror> get methods; /** * An immutable map from names to mirrors for all getter * declarations for this type. */ Map<String, MethodMirror> get getters; /** * An immutable map from names to mirrors for all setter * declarations for this type. */ Map<String, MethodMirror> get setters; /** * An immutable map from names to mirrors for all variable * declarations for this type. */ Map<String, VariableMirror> get variables; /** * An immutable map from names to mirrors for all constructor * declarations for this type. */ Map<String, MethodMirror> get constructors; /** * An immutable map from names to mirrors for all type variables for * this type. * * This map preserves the order of declaration of the type variables. */ Map<String, TypeVariableMirror> get typeVariables; /** * An immutable map from names to mirrors for all type arguments for * this type. * * This map preserves the order of declaration of the type variables. */ Map<String, TypeMirror> get typeArguments; /** * Is this the original declaration of this type? * * For most classes, they are their own original declaration. For * generic classes, however, there is a distinction between the * original class declaration, which has unbound type variables, and * the instantiations of generic classes, which have bound type * variables. */ bool get isOriginalDeclaration; /** * A mirror on the original declaration of this type. * * For most classes, they are their own original declaration. For * generic classes, however, there is a distinction between the * original class declaration, which has unbound type variables, and * the instantiations of generic classes, which have bound type * variables. */ ClassMirror get originalDeclaration; /** * Invokes the named constructor and returns a mirror on the result. * * TODO(turnidge): Properly document. */ Future<InstanceMirror> newInstance(String constructorName, List<Object> positionalArguments, [Map<String,Object> namedArguments]); /** * Does this mirror represent a class? * * TODO(turnidge): This functions goes away after the * class/interface changes. */ bool get isClass; /** * A mirror on the default factory class or null if there is none. * * TODO(turnidge): This functions goes away after the * class/interface changes. */ ClassMirror get defaultFactory; }
Subclasses
FunctionTypeMirror, TypedefMirror
Implements
Properties
final Map<String, MethodMirror> constructors #
An immutable map from names to mirrors for all constructor declarations for this type.
Map<String, MethodMirror> get constructors;
final ClassMirror defaultFactory #
A mirror on the default factory class or null if there is none.
TODO(turnidge): This functions goes away after the class/interface changes.
ClassMirror get defaultFactory;
final Map<String, MethodMirror> getters #
An immutable map from names to mirrors for all getter declarations for this type.
Map<String, MethodMirror> get getters;
final bool isClass #
Does this mirror represent a class?
TODO(turnidge): This functions goes away after the class/interface changes.
bool get isClass;
final bool isOriginalDeclaration #
Is this the original declaration of this type?
For most classes, they are their own original declaration. For generic classes, however, there is a distinction between the original class declaration, which has unbound type variables, and the instantiations of generic classes, which have bound type variables.
bool get isOriginalDeclaration;
final bool isPrivate #
Is this declaration private?
Note that for libraries, this will be false
.
bool get isPrivate;
final bool isTopLevel #
Is this declaration top-level?
This is defined to be equivalent to:
mirror.owner !== null && mirror.owner is LibraryMirror
bool get isTopLevel;
final SourceLocation location #
The source location of this Dart language entity.
SourceLocation get location;
final Map<String, Mirror> members #
An immutable map from from names to mirrors for all members of this type.
The members of a type are its methods, fields, getters, and setters. Note that constructors and type variables are not considered to be members of a type.
This does not include inherited members.
Map<String, Mirror> get members;
final Map<String, MethodMirror> methods #
An immutable map from names to mirrors for all method, declarations for this type. This does not include getters and setters.
Map<String, MethodMirror> get methods;
final MirrorSystem mirrors #
The MirrorSystem that contains this mirror.
MirrorSystem get mirrors;
final ClassMirror originalDeclaration #
A mirror on the original declaration of this type.
For most classes, they are their own original declaration. For generic classes, however, there is a distinction between the original class declaration, which has unbound type variables, and the instantiations of generic classes, which have bound type variables.
ClassMirror get originalDeclaration;
final DeclarationMirror owner #
A mirror on the owner of this function. This is the declaration immediately surrounding the reflectee.
Note that for libraries, the owner will be null
.
DeclarationMirror get owner;
final String qualifiedName #
The fully-qualified name for this Dart language entity.
This name is qualified by the name of the owner. For instance, the qualified name of a method 'method' in class 'Class' in library 'library' is 'library.Class.method'.
TODO(turnidge): Specify whether this name is unique. Currently this is a gray area due to lack of clarity over whether library names are unique.
String get qualifiedName;
final Map<String, MethodMirror> setters #
An immutable map from names to mirrors for all setter declarations for this type.
Map<String, MethodMirror> get setters;
final String simpleName #
The simple name for this Dart language entity.
The simple name is in most cases the the identifier name of the
entity, such as 'method' for a method void method() {...}
or
'mylibrary' for a #library('mylibrary');
declaration.
String get simpleName;
final ClassMirror superclass #
A mirror on the superclass on the reflectee.
If this type is Object
or a typedef, the superClass will be
null.
ClassMirror get superclass;
final List<ClassMirror> superinterfaces #
A list of mirrors on the superinterfaces of the reflectee.
List<ClassMirror> get superinterfaces;
final Map<String, TypeMirror> typeArguments #
An immutable map from names to mirrors for all type arguments for this type.
This map preserves the order of declaration of the type variables.
Map<String, TypeMirror> get typeArguments;
final Map<String, TypeVariableMirror> typeVariables #
An immutable map from names to mirrors for all type variables for this type.
This map preserves the order of declaration of the type variables.
Map<String, TypeVariableMirror> get typeVariables;
final Map<String, VariableMirror> variables #
An immutable map from names to mirrors for all variable declarations for this type.
Map<String, VariableMirror> get variables;
Methods
Future<InstanceMirror> getField(String fieldName) #
Invokes a getter and returns a mirror on the result. The getter can be the implicit getter for a field or a user-defined getter method.
TODO(turnidge): Handle ambiguous names.
Future<InstanceMirror> getField(String fieldName);
Future<InstanceMirror> invoke(String memberName, List<Object> positionalArguments, [Map<String, Object> namedArguments]) #
Invokes the named function and returns a mirror on the result.
TODO(turnidge): Properly document. TODO(turnidge): Handle ambiguous names. TODO(turnidge): Handle optional & named arguments.
Future<InstanceMirror> invoke(String memberName, List<Object> positionalArguments, [Map<String,Object> namedArguments]);
Future<InstanceMirror> newInstance(String constructorName, List<Object> positionalArguments, [Map<String, Object> namedArguments]) #
Invokes the named constructor and returns a mirror on the result.
TODO(turnidge): Properly document.
Future<InstanceMirror> newInstance(String constructorName, List<Object> positionalArguments, [Map<String,Object> namedArguments]);
Future<InstanceMirror> setField(String fieldName, Object value) #
Invokes a setter and returns a mirror on the result. The setter may be either the implicit setter for a non-final field or a user-defined setter method.
TODO(turnidge): Handle ambiguous names.
Future<InstanceMirror> setField(String fieldName, Object value);