processBeforeInitialization method

  1. @override
Future<Object?> processBeforeInitialization(
  1. Object pod,
  2. Class podClass,
  3. String name
)

Processes the pod before any initialization callbacks are invoked.

This method is called after property population but before any @PostConstruct methods or initialization-aware interface callbacks. The pod is fully constructed with dependencies injected but not yet initialized.

Transformation Semantics

The method can:

  • Return the original pod instance (no transformation)
  • Return a wrapped/decorated instance (enhancement)
  • Return null to suppress further processing (advanced use cases)
  • Throw an exception to prevent pod initialization

Parameters

@param pod The pod instance to process @param podClass The class metadata of the pod @param name The name of the pod in the container @return The pod instance to use (original, wrapped, or null)

Example:

@override
Future<Object?> processBeforeInitialization(Object pod, Class podClass, String name) async {
  if (podClass.hasAnnotation<Measured>()) {
    return PerformanceMonitor.wrap(pod, name);
  }
  return pod;
}

Implementation

@override
Future<Object?> processBeforeInitialization(Object pod, Class podClass, String name) async => pod;