ConditionalOnPod class
The ConditionalOnPod
annotation in Jetleaf allows developers to
conditionally process classes or methods based on the presence of specific
pods in the application context.
This is especially useful when you want a configuration, service, or pod to only be loaded if another pod (or set of pods) already exists. Conditions can be defined by pod type, annotation, or name.
Key Features:
- Require specific pod types to exist in the context.
- Require pods annotated with certain annotations.
- Require pods with given names.
Usage Examples:
// Require a specific pod type
@ConditionalOnPod(types: [ClassType<DataSource>()])
class JdbcTemplateConfig {}
// Require a pod with a specific name
@ConditionalOnPod(names: ['myCustomService'])
class FallbackServiceConfig {}
Using this annotation ensures your configuration or beans are only registered when the expected pods are already available in the Jetleaf context.
- Annotations
-
- @Conditional([ClassType<OnPodCondition>()])
- @Target.new({TargetKind.classType, TargetKind.method})
Constructors
-
ConditionalOnPod({List<
ClassType< types = const [], List<Object> >String> names = const []}) -
The
ConditionalOnPod
annotation in Jetleaf allows developers to conditionally process classes or methods based on the presence of specific pods in the application context.const
Properties
- annotationType → Type
-
Returns the annotation _type of this annotation.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
names
→ List<
String> -
Pod names that must be present in the context.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
types
→ List<
ClassType< Object> > -
Pod types that must be present in the context.
final
Methods
-
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode
, andtoString
. -
equals(
Object other) → bool -
Checks whether the given object is logically equivalent to this annotation.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String - Returns a string representation of this annotation.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited