# getDefinitionByClass method

1. @override

PodDefinition getDefinitionByClass(

1. Class type

)
override

Returns the pod definition for the specified class type.

This method looks up the pod definition by class rather than by name.

Usage Example:

    final factory = getPodFactory();
    final definition = factory.getDefinitionByClass(Class.forObject(MyService));

`type` the class type to look up Returns the PodDefinition for the specified class

Throws `PodNotFoundException` if no pod is defined for the class

## Implementation

    @override
    PodDefinition getDefinitionByClass(Class type) {
      final names = getDefinitionNames();
      for (final name in names) {
        final podDef = getDefinition(name);
        if (podDef.type == type || podDef.type.isSubclassOf(type) || type.isAssignableFrom(podDef.type)) {
          return podDef;
        }
      }

      throw PodDefinitionStoreException(
        name: type.getQualifiedName(),
        resourceDescription: null,
        msg: "No pod of type '$type' is defined"
      );
    }