findAnnotationOnPod<A> method

  1. @override
Future<A?> findAnnotationOnPod<A>(
  1. String podName,
  2. Class<A> type
)

Finds a specific annotation on a pod.

This method looks for annotations of the specified type on the given pod and returns the first one found.

Usage Example:

final annotation = await factory.findAnnotationOnPod<RestController>(
  'userController', 
  Class<RestController>(),
);

if (annotation != null) {
  print('Controller path: ${annotation.path}');
}

@param podName The name of the pod to check @param type The annotation type to look for @return A Future that completes with the annotation or null if not found

Implementation

@override
Future<A?> findAnnotationOnPod<A>(String podName, Class<A> type) async {
  if (_parent != null && await _parent!.getPodFactory().containsDefinition(podName)) {
    return await _parent!.getPodFactory().findAnnotationOnPod(podName, type);
  }

  return await getPodFactory().findAnnotationOnPod(podName, type);
}