PodSpec<T> class final

A concrete implementation of the `Spec` API in Jetleaf.

PodSpec provides the internal mechanism for building, configuring, and cloning pod definitions that are registered into the container.

While developers usually interact with the higher-level `Spec` API when customizing pods, Jetleaf internally uses PodSpec to hold the actual configuration state.

Key Details

  • Backed by a `RootPodDefinition` that stores all pod metadata.
  • All configuration methods from `Spec` delegate into this root definition.
  • Ensures that pods are fully validated before cloning into the registry.

Example

Developers typically don’t instantiate PodSpec directly, but interact with it through the registerPod API:

registry.registerPod(MyService.classType, customizer: (spec) {
  spec
    .namedAs('myService')
    .withScope(ScopeType.singleton)
    .describedAs('Provides the MyService business logic')
    .suppliedBy((ctx) => MyService());
});
Inheritance
Annotations
  • @Generic.new(PodSpec)

Constructors

PodSpec(SpecContext _context)
A concrete implementation of the `Spec` API in Jetleaf.

Properties

annotatedClasses List<Class>
The list of annotation classes which the type of this pod definition is annotated with.
finalinherited
annotations List<Annotation>
The complete list of annotations discovered on the class and its meta-annotations.
finalinherited
autowireCandidate ↔ AutowireCandidateDescriptor
Defines whether this pod is eligible for autowiring.
getter/setter pairinherited
canProxy bool
Whether this pod is eligible for proxying.
getter/setter pairinherited
dependencyCheck ↔ DependencyCheck
Defines the dependency validation strategy.
getter/setter pairinherited
dependsOn List<DependencyDesign>
Other dependencies that this pod depends on.
getter/setter pairinherited
description String?
A description of the pod.
getter/setter pairinherited
design ↔ DesignDescriptor
Defines the design role of the pod.
getter/setter pairinherited
executableArgumentValues ↔ ConstructorArgumentValues
Arguments to be passed to the pod’s constructor.
getter/setter pairinherited
factoryMethod ↔ FactoryMethodDesign
The factory method used to create this pod.
getter/setter pairinherited
hasBeforeInstantiationResolved bool
Whether this pod has been resolved before instantiation.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isPodProvider bool
Whether this pod is a provider of other pods.
getter/setter pairinherited
lifecycle ↔ LifecycleDesign
Defines the lifecycle behavior of the pod.
getter/setter pairinherited
name String
The unique name of the pod (component).
getter/setter pairinherited
preferredConstructors List<Constructor>
List of preferred constructors for autowiring.
finalinherited
propertyValues ↔ MutablePropertyValues
Mutable property values assigned to this pod.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope ↔ ScopeDesign
Defines the scope of the pod.
getter/setter pairinherited
type ↔ Class
The Class type that this pod represents.
getter/setter pairinherited

Methods

addConstructorArguments(ArgumentValue argument) Spec<T>
Adds a constructor argument for pod instantiation.
override
addPropertyValue(PropertyValue value) Spec<T>
Adds a property value to this pod definition.
override
asAutowireCandidate(AutowireMode mode) Spec<T>
Declares this pod as an autowire candidate with the given mode.
override
asPodProvider() Spec<T>
Marks this spec as a pod provider (i.e., a factory for other pods).
override
clone() → PodDefinition
Creates and returns a deep clone of this pod definition.
createdBy(String factoryClassPodName, String methodName, Class factoryClass) Spec<T>
Configures a factory method for creating this pod.
override
dependingOn(List<DependencyDesign> dependencies) Spec<T>
Declares dependencies required for this pod.
override
describedAs(String description) Spec<T>
Adds a human-readable description to this pod spec.
This can be useful for debugging, logging, or documentation purposes.
override
designedWithLifecycle({bool lazy = false, List<String> initMethods = const [], List<String> destroyMethods = const [], bool enforceInitMethod = false, bool enforceDestroyMethod = false}) Spec<T>
Configures lifecycle design for the pod.
override
equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
inherited
expressedWith(PodExpression<Object> expression) Spec<T>
Configures the pod using a custom expression.
override
getAnnotation<A>() → A?
Returns the annotation of type A, if present.
inherited
getAnnotations<A>() List<A>
Returns a list of annotations of type A.
inherited
hasAnnotation<A>() bool
Returns true if this definition has an annotation of type A.
inherited
hasConstructorArgumentValues() bool
Returns whether this pod definition contains any constructor argument values.
inherited
hasPreferredConstructors() bool
Returns whether this pod definition has any preferred constructors.
inherited
hasPropertyValues() bool
Returns whether this pod definition contains any property values.
inherited
isAbstractAndNoFactory() bool
Returns true if this definition is non-instantiable.
inherited
namedAs(String name) Spec<T>
Assigns a logical name to this pod spec.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
suppliedBy(T supplier(SpecContext context)) Spec<T>
Supplies a pod instance using a supplier function.
override
target(Class<T> type) Spec<T>
Targets this spec towards a specific type.
override
toString() String
A string representation of this object.
inherited
toStringOptions() → ToStringOptions
inherited
withAutowire(AutowireCandidateDescriptor descriptor) Spec<T>
Provides a descriptor describing autowiring rules for this pod.
override
withDesign(DesignDescriptor design) Spec<T>
Associates a design descriptor with this pod.
A design encapsulates structural or semantic metadata about the pod.
override
withDesignRole(DesignRole role, {bool isPrimary = false}) Spec<T>
Assigns a design role to this pod, with an option to mark it as isPrimary for autowiring resolution.
override
withFactory(FactoryMethodDesign descriptor) Spec<T>
Defines this pod using a factory descriptor.
override
withLifecycle(LifecycleDesign lifecycle) Spec<T>
Attaches a lifecycle lifecycle definition to this pod.
override
withScope(ScopeType type) Spec<T>
Defines the type of scope this pod belongs to (e.g., singleton, prototype).
override

Operators

operator ==(Object other) bool
The equality operator.
inherited