2.3.0
Changes in this release:
This release implements functionality to create an interface with prompt / generate methods:
public interface PromptInterface {
@Prompt("Age") @Range({0, 100})
int requestAge();
@Generate @Fill(8)
int[] generateNumbers();
@Inject
Scanner getScanner();
}
Such an interface can be created either using the @Factory
annotation in an entrypoint:
@Entrypoint(verbose = true)
public void run (
@Factory final PromptInterface pi
) {
System.out.println("8 Generated Numbers: " + Arrays.toString(pi.generateNumbers()));
System.out.println("Your Age: " + pi.requestAge());
System.out.print("Type anything: ");
System.out.println("You typed: " + pi.getScanner().nextLine());
}
// console:
// 8 Generated Numbers: [5, 9, 5, 4, 6, 10, 10, 10]
// [int] [0-100] Age > 31
// Your Age: 31
// Type anything: Hello! :)
// You typed: Hello! :)
Or by using the PromptFactor.build() method:
final PromptInterface pi = PromptFactory.build(PromptInterface.class,
/* optional: */ new Injector().register(Scanner.class, new Scanner(System.in));
Contributors
Installation
Maven
- Add this repository to your
pom.xml
:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
- Add the
eeee
-dependency:
<dependency>
<groupId>com.github.darmiel</groupId>
<artifactId>eeee</artifactId>
<version>2.3.0</version>
</dependency>