Dart Documentationangular.coreAnnotationMap<K>

AnnotationMap<K> abstract class

abstract class AnnotationMap<K> {
 final Map<K, Type> _map = {};

 AnnotationMap(Injector injector, MetadataExtractor extractMetadata) {
   injector.types.forEach((type) {
     var meta = extractMetadata(type)
       .where((annotation) => annotation is K)
       .forEach((annotation) {
         if (_map.containsKey(annotation)) {
           var annotationType = K;
           throw "Duplicate annotation found: $annotationType: $annotation. " +
                 "Exisitng: ${_map[annotation]}; New: $type.";
         }
         _map[annotation] = type;
       });
   });
 }

 Type operator[](K annotation) {
   var value = _map[annotation];
   if (value == null) {
     throw 'No $annotation found!';
   }
   return value;
 }

 forEach(fn(K, Type)) => _map.forEach(fn);
}

Subclasses

DirectiveMap, FilterMap

Constructors

new AnnotationMap(Injector injector, MetadataExtractor extractMetadata) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
AnnotationMap(Injector injector, MetadataExtractor extractMetadata) {
 injector.types.forEach((type) {
   var meta = extractMetadata(type)
     .where((annotation) => annotation is K)
     .forEach((annotation) {
       if (_map.containsKey(annotation)) {
         var annotationType = K;
         throw "Duplicate annotation found: $annotationType: $annotation. " +
               "Exisitng: ${_map[annotation]}; New: $type.";
       }
       _map[annotation] = type;
     });
 });
}

Operators

Type operator [](K annotation) #

Type operator[](K annotation) {
 var value = _map[annotation];
 if (value == null) {
   throw 'No $annotation found!';
 }
 return value;
}

Methods

dynamic forEach(fn(K, Type)) #

forEach(fn(K, Type)) => _map.forEach(fn);