PackageIdentifier class abstract interface

Represents an abstraction for identifying the package that an object, resource, or service belongs to.

This interface provides a consistent way to query the "owning package" in Jetleaf systems. It is particularly useful when working with modular architectures, dependency resolution, or when generating qualified names that depend on package information.

Example

Implementing a simple package identifier:

class MyService implements PackageIdentifier {
  @override
  String getPackageName() => "example";
}

void main() {
  final service = MyService();
  print(service.getPackageName()); // example
}

Using package identifiers to register components:

void registerComponent(PackageIdentifier component) {
  print("Registering component from package: ${component.getPackageName()}");
}

class DatabaseModule implements PackageIdentifier {
  @override
  String getPackageName() => "example";
}

void main() {
  final db = DatabaseModule();
  registerComponent(db); // Registering component from package: example
}

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

getPackageName() String
Represents an abstraction for identifying the package that an object, resource, or service belongs to.
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