LibraryMirror abstract class
A LibraryMirror reflects a Dart language library, providing access to the variables, functions, and classes of the library.
abstract class LibraryMirror implements DeclarationMirror, ObjectMirror { /** * The url of the library. * * TODO(turnidge): Document where this url comes from. Will this * value be sensible? */ String get url; /** * An immutable map from from names to mirrors for all members in * this library. * * The members of a library are its top-level classes, * functions, variables, getters, and setters. */ Map<String, Mirror> get members; /** * An immutable map from names to mirrors for all class * declarations in this library. */ Map<String, ClassMirror> get classes; /** * An immutable map from names to mirrors for all function, getter, * and setter declarations in this library. */ Map<String, MethodMirror> get functions; /** * An immutable map from names to mirrors for all getter * declarations in this library. */ Map<String, MethodMirror> get getters; /** * An immutable map from names to mirrors for all setter * declarations in this library. */ Map<String, MethodMirror> get setters; /** * An immutable map from names to mirrors for all variable * declarations in this library. */ Map<String, VariableMirror> get variables; }
Implements
ObjectMirror, DeclarationMirror
Properties
final Map<String, ClassMirror> classes #
An immutable map from names to mirrors for all class declarations in this library.
Map<String, ClassMirror> get classes;
final Map<String, MethodMirror> functions #
An immutable map from names to mirrors for all function, getter, and setter declarations in this library.
Map<String, MethodMirror> get functions;
final Map<String, MethodMirror> getters #
An immutable map from names to mirrors for all getter declarations in this library.
Map<String, MethodMirror> get getters;
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 in this library.
The members of a library are its top-level classes, functions, variables, getters, and setters.
Map<String, Mirror> get members;
final MirrorSystem mirrors #
The MirrorSystem that contains this mirror.
MirrorSystem get mirrors;
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 in this library.
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 String url #
The url of the library.
TODO(turnidge): Document where this url comes from. Will this value be sensible?
String get url;
final Map<String, VariableMirror> variables #
An immutable map from names to mirrors for all variable declarations in this library.
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> 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);