An advanced DI framework for JVM and Android applications based on the Java Reflection API with a specialized implementation for jMonkeyEngine Applications.
What's the problem? | How Jector solves it? | How DI works in general? | How DI works in Jector? | What are some good examples of Jector? | Synergism with Virtual Threads? |
---|---|---|---|---|---|
The problem is doing multi-threaded/concurrent code in games is overwhelming and will require you to use synchronization or locks at some point in your application which might disrupt the architecture in your final software product. | Jector solves this by making good use of the DI pattern to bind your proposed function stack frame as a WorkerTask to a TaskExecutor instance, a TaskExecutor instance could be a Thread, a Game State, an Android Task,...etc. |
DI stands for Dependency Injection, as the name implies, it consists of 3 objects, a dependency object, a dependent object, and an injector object, the dependency object contains the delegation code that is utilized by a dependent object, the injector object role is to pass the dependency object to the actual dependent to complete its job. | DI in Jector works by injecting a method as a WorkerTask (dependency) into a TaskExecutor (dependent object) using a TaskExecutorManager (injector object). | Loading game assets asynchronously is now easier, by enabling some tasks to be executed at some point on their respective threads. | WIP |
┌─[pavl-machine@pavl-machine]─[/home/twisted/GradleProjects/Jector]
└──╼ $./gradlew :jector:build && \
./gradlew :jector:generateSourcesJar && \
./gradlew :jector:generateJavadocJar && \
./gradlew :jector-monkey build && \
./gradlew :jector-monkey generateSourcesJar && \
./gradlew :jector-monkey generateJavadocJar
┌─[pavl-machine@pavl-machine]─[/home/twisted/GradleProjects/Jector]
└──╼ $./gradlew :jector-examples:run
- build.gradle:
repositories {
mavenCentral()
}
dependencies {
implementation "io.github.software-hardware-codesign:jector:1.0.0-pre-alpha"
implementation "io.github.software-hardware-codesign:jector-monkey:1.0.0-pre-alpha"
implementation "org.jmonkeyengine:jme3-core:3.6.1-stable"
implementation "org.jmonkeyengine:jme3-desktop:3.6.1-stable"
implementation "org.jmonkeyengine:jme3-lwjgl3:3.6.1-stable"
}
- Jector Dependencies are Functional Java Worker methods tasked in a TaskExecutor instance.
- Multi-threaded async dependency tasking.
- Single-threaded dependency tasking.
- Non-threaded tasking.
- Supports dependency arguments.
- Supports dependency return objects to the caller (the parent task executor).
- Supports OO Polymorphism over the Worker classes (need to add all the workers statically to the TaskExecutorManager).
- Supports Android and jMonkeyEngine Applications.
- Dependencies are defined by some Method objects as
WorkerTasks
. - Dependencies created from Worker Method objects only.
- Dependencies are bound to their Executors (threads, states, ...) interfaces via WorkerTasks (which enclose those low-level worker Methods).
- Dependencies could be only instantiated from Worker Methods (annotated methods inside Worker classes).
- A
Worker
interface is a marker interface for the Jector Framework. - A
Worker
implementation signifies a runtime environment for the DI actions. - A
TaskExecutorManager
implementation has a Worker instance and is the injector object that creates WorkerTasks from Worker Methods and injects them into annotated TaskExecutors. - A
TaskExecutor
implementation is a wrapper to a collection of WorkerTasks to be executed, TaskExecutor could be a State, a Thread, a Server Container,...etc.