| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // #library("mirrors"); | 5 // #library("mirrors"); |
| 6 | 6 |
| 7 // The dart:mirrors library provides reflective access for Dart program. | 7 // The dart:mirrors library provides reflective access for Dart program. |
| 8 // | 8 // |
| 9 // For the purposes of the mirrors library, we adopt a naming | 9 // For the purposes of the mirrors library, we adopt a naming |
| 10 // convention with respect to getters and setters. Specifically, for | 10 // convention with respect to getters and setters. Specifically, for |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 */ | 114 */ |
| 115 interface ObjectMirror extends Mirror { | 115 interface ObjectMirror extends Mirror { |
| 116 /** | 116 /** |
| 117 * Invokes the named function and returns a mirror on the result. | 117 * Invokes the named function and returns a mirror on the result. |
| 118 * | 118 * |
| 119 * TODO(turnidge): Properly document. | 119 * TODO(turnidge): Properly document. |
| 120 */ | 120 */ |
| 121 Future<InstanceMirror> invoke(String memberName, | 121 Future<InstanceMirror> invoke(String memberName, |
| 122 List<Object> positionalArguments, | 122 List<Object> positionalArguments, |
| 123 [Map<String,Object> namedArguments]); | 123 [Map<String,Object> namedArguments]); |
| 124 |
| 125 /** |
| 126 * Invokes a getter and returns a mirror on the result. The getter may be |
| 127 * either the implicit getter for a field or a user-defined getter method. |
| 128 */ |
| 129 Future<InstanceMirror> getField(String fieldName); |
| 130 |
| 131 /** |
| 132 * Invokes a setter and returns a mirror on the result. The setter may be |
| 133 * either the implicit setter for a non-final field or a user-defined setter |
| 134 * method. |
| 135 */ |
| 136 Future<InstanceMirror> setField(String fieldName, Object value); |
| 124 } | 137 } |
| 125 | 138 |
| 126 /** | 139 /** |
| 127 * An [InstanceMirror] reflects an instance of a Dart language object. | 140 * An [InstanceMirror] reflects an instance of a Dart language object. |
| 128 */ | 141 */ |
| 129 interface InstanceMirror extends ObjectMirror { | 142 interface InstanceMirror extends ObjectMirror { |
| 130 /** | 143 /** |
| 131 * Returns a mirror on the class of the reflectee. | 144 * Returns a mirror on the class of the reflectee. |
| 132 */ | 145 */ |
| 133 InterfaceMirror getClass(); | 146 InterfaceMirror getClass(); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 512 |
| 500 /** | 513 /** |
| 501 * A [MirrorException] is used to indicate errors within the mirrors | 514 * A [MirrorException] is used to indicate errors within the mirrors |
| 502 * framework. | 515 * framework. |
| 503 */ | 516 */ |
| 504 class MirrorException implements Exception { | 517 class MirrorException implements Exception { |
| 505 const MirrorException(String this._message); | 518 const MirrorException(String this._message); |
| 506 String toString() => "MirrorException: '$_message'"; | 519 String toString() => "MirrorException: '$_message'"; |
| 507 final String _message; | 520 final String _message; |
| 508 } | 521 } |
| OLD | NEW |