MethodUtils class final

Provides reflective utility functions for working with JetLeaf runtime Method and MethodDeclaration instances.

This class centralizes common operations such as collecting annotated methods and deduplicating them by identity, helping JetLeaf subsystems like lifecycle management, annotation scanning, and component discovery operate efficiently.

The static methods of MethodUtils are designed to be called by JetLeaf’s internal processors, such as the LifecycleRunListener, without requiring direct instantiation.

Example

final annotatedMethods = <Method>{};
MethodUtils.collectMethods<OnApplicationReady>(annotatedMethods);

for (final method in annotatedMethods) {
  print('Discovered lifecycle method: ${method.getName()}');
}

The above example demonstrates scanning for all runtime methods annotated with @OnApplicationReady and collecting them into a set for later invocation by JetLeaf’s event system.

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
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

canAcceptArguments(Map<String, dynamic> arguments, Iterable<Parameter> parameters) bool
Checks whether a set of arguments can be applied to a list of parameters.
canAcceptNamedArguments(Map<String, dynamic> arguments, Iterable<Parameter> parameters) bool
Checks whether a set of named arguments can be applied to a method's named parameters.
canAcceptPositionalArguments(List args, Iterable<Parameter> parameters) bool
Checks whether a list of positional arguments can be applied to a method's positional parameters.
collectMethods<T extends ReflectableAnnotation>([bool inJetleaf = true]) Iterable<Method>
Lazily collects all methods annotated with a JetLeaf annotation type T.
getDefaultMethodNames() List<String>
Returns a list of method names that are considered default or framework-intrinsic and should typically be ignored when scanning for repository operations.