# findAllAnnotationsOnPod<A> method

1. @override

Future<Set<A>> findAllAnnotationsOnPod<A>(

1. String podName,
2. Class<A> type

)
override

Finds all annotations of the specified type on a pod.

Some annotations can be repeated (like @RequestMapping in controllers). This method returns all instances of the annotation.

## Usage Example:

    final validations = await factory.findAllAnnotationsOnPod<Validated>(
      'userService',
      Class<Validated>(),
    );

    for (final validation in validations) {
      print('Validation rule: ${validation.rule}');
    }

@param podName The name of the pod to check @param type The annotation type to look for @return A Future that completes with a set of all found annotations

## Implementation

    @override
    Future<Set<A>> findAllAnnotationsOnPod<A>(String podName, Class<A> type) async {
      final result = <A>{};

      try {
        if (containsDefinition(podName)) {
          final podDef = getDefinition(podName);
          final podClass = podDef.type;

          if (podClass.hasDirectAnnotation<A>()) {
            final annotation = podClass.getDirectAnnotation<A>();
            if (annotation != null) {
              result.add(annotation);
            }
          } else if (podDef.hasAnnotation<A>()) {
            final annotation = podDef.getAnnotation<A>();
            if (annotation != null) {
              result.add(annotation);
            }
          }
        }
      } catch (e) {
        if(_logger.getIsTraceEnabled()) {
          _logger.trace("Could not find annotations on pod '$podName': $e");
        }
      }

      return result;
    }