commander

Visionary Software Solutions Commander: COMMAND — bidirectional adaptation between java.lang.Runnable and Command.

Canonical Command design pattern abstractions providing first-class command execution and bidirectional adaptation with java.lang.Runnable.

Rationale

Why. Standardizing execution contracts around the Gang of Four Command pattern clarifies intent and enables bidirectional Runnable interop.

Problem. Over-reliance on plain Runnable obscures domain intent and misses opportunities for structured, parameterized command pipelines.

Solution. Command is the execution abstraction; CommandFactory builds one from whatever a caller has on hand; Commands is the singleton AGGREGATE ROOT that adapts a Runnable to a Command and a Command to a Runnable, contract-checked at the boundary.

Key Concepts

Command

Role. Foundational command execution interface.

Pattern. Command

CommandFactory

Role. Makes a Command from what it needs to do its job; the general shape every command factory shares.

Pattern. Factory

Commands

Role. Singleton AGGREGATE ROOT that adapts a Runnable to a Command and a Command to a Runnable.

Pattern. Adapter

How It Works

Guarantees. Guarantees lossless delegation and exception propagation across command and runnable invocations. It reads nothing at run time.

Thread safety. Stateless command adapters are thread-safe.

Lane

Purpose. Domain execution abstraction and runnable adaptation lane.

Alternative. For direct JVM threads, use java.lang.Runnable directly.

Usage

Executing and adapting commands

Command cmd = () -> System.out.println("Executing");
cmd.execute();
Runnable runnable = Commands.INSTANCE.adapt(cmd);
Command adapted = Commands.INSTANCE.adapt(runnable);

Dependencies

  • software.visionary.contrax:processor:2026.10.13 at Processor
  • software.visionary:junit-closure:2026.09.17 at Testing

Caveats

  • Command executions propagate unchecked runtime exceptions thrown by underlying actions.

Views

Drawn from the release. A link in a view opens its source at the release tag.

architecture.svg
architecture.svg
classes.software.visionary.commander.svg
classes.software.visionary.commander.svg
execution-flow.svg
execution-flow.svg
packages.svg
packages.svg