PodFactoryAware class abstract interface

🫘 Interface for components that need access to the PodFactory.

The PodFactoryAware interface is part of JetLeaf's Aware interface pattern, which provides a standardized way for framework-managed components to receive callback notifications about their runtime environment.

When to Implement:

Implement this interface when your component needs to:

  • Programmatically access other pods not available through constructor injection
  • Perform dynamic lookups based on runtime conditions
  • Access container metadata or advanced DI features
  • Implement custom lifecycle logic that requires container interaction

Framework Integration:

  • Called automatically by the framework after pod instantiation
  • Invoked before any @PostConstruct methods
  • The provided PodFactory is fully configured and operational

Example Usage:

class DynamicServiceLocator implements PodFactoryAware {
  late PodFactory _podFactory;

  @override
  void setPodFactory(PodFactory podFactory) {
    _podFactory = podFactory;
  }

  T getService<T>(String serviceName) {
    return _podFactory.getPod<T>(serviceName);
  }

  bool hasService(String serviceName) {
    return _podFactory.containsPod(serviceName);
  }
}

Best Practices:

  • Store the PodFactory reference in a late final field
  • Avoid expensive operations in the setter method
  • Prefer constructor injection over PodFactoryAware when possible
  • Use for advanced scenarios where static dependency resolution is insufficient

See also:

Properties

hashCode β†’ int
The hash code for this object.
no setterinherited
runtimeType β†’ Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) β†’ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setPodFactory(PodFactory podFactory) β†’ void
Sets the PodFactory that created and manages this component.
toString() β†’ String
A string representation of this object.
inherited

Operators

operator ==(Object other) β†’ bool
The equality operator.
inherited