ClassType<T> class
The ClassType
class in Jetleaf represents a reference to a Dart
class, optionally including metadata such as package, protection domain,
or type declaration.
It provides a convenient way to convert a class reference into a Class instance used by the Jetleaf framework for reflection, conditional processing, or pod registration.
Key Features:
- Supports optional class name, package, ProtectionDomain, and TypeDeclaration.
- Can convert itself into a Class instance using toClass.
- Integrates with Jetleaf's type system for dynamic class handling.
Usage Example:
import 'package:jetleaf/jetleaf.dart';
// Create a ClassType by name
final simpleClass = ClassType(name: 'UserService');
// Convert to a Jetleaf Class instance
final userClass = simpleClass.toClass();
// Create a ClassType with a TypeDeclaration
final declaredClass = ClassType(declaration: someTypeDeclaration);
final declaredClassInstance = declaredClass.toClass();
Constructors
- ClassType({String? name, String? package, ProtectionDomain? pd, TypeDeclaration? declaration})
-
The
ClassType
class in Jetleaf represents a reference to a Dart class, optionally including metadata such as package, protection domain, or type declaration.const
Properties
- declaration → TypeDeclaration?
-
Optional TypeDeclaration that represents the class declaration.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String?
-
The simple name of the class.
final
- package → String?
-
The package the class belongs to, if any.
final
- pd → ProtectionDomain?
-
The ProtectionDomain associated with this class reference.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getType(
) → Type -
Returns the type parameter
T
of this ClassType. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toClass(
) → Class< T> - Converts this ClassType into a Class instance used by Jetleaf.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited