Releases: darmiel/eeee
2.6.0
Changes in this release:
Thie release implements a new annotation for generation: @FillRange
.
This annotation works like @Fill
with the difference that the number of values in the specified range is randomly generated
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.6.0</version>
</dependency>
2.5.1
Changes in this release:
This release fixes a bug (#10) where hidden entry points (called entry points) interfered with the auto start first entry point feature.
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.5.1</version>
</dependency>
2.5.0
Changes in this release:
This release implements functionality to call other entry points:
@Entrypoint("__get_name")
public String runGetName(@Prompt("Enter Name") final String name) {
return name;
}
@Entrypoint
public void run(
@Entrypoint("__get_name") final Call<String> nameCall
) {
for (int i = 0; i < 5; i++) {
System.out.println("Name " + (i + 1) + ": " + nameCall.call());
}
}
[String] Enter Name > Daniel
Name 1: Daniel
[String] Enter Name > Test2
Name 2: Test2
[String] Enter Name > Test4
// ...
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.5.0</version>
</dependency>
2.4.1
Changes in this release:
This release fixes a NPE in TableBuilder
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.4.1</version>
</dependency>
2.4.0
Changes in this release:
This release implements tables!
- Create an object which represents a row:
@HeaderOrder({"First Name", "Age"}) // specifies the sorting of the headers
public static class Person {
@Column("First Name") // must be same as in HeaderOrder
public final String first;
@Column("Age") // must be same as in HeaderOrder
public final int age;
}
- Create table
final Person[] people = new Person[5];
RandomFactory.fill(people); // generate random person objects
// create table and fill with array
final Table table = TableBuilder.from(people, Person.class)
.color(true)
.style(TableStyle.ROUND);
System.out.println(table);
Output
╭────────────┬─────╮
│ First Name │ Age │
├────────────┼─────┤
│ Margaret │ 42 │
│ Michael │ 79 │
│ Anna │ 43 │
│ Cynthia │ 50 │
│ Margaret │ 82 │
╰────────────┴─────╯
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.4.0</version>
</dependency>
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>
2.2.0
Changes in this release:
- Refactoring
StringConverter#getSuperTree
System.out.println(StringConverter.getSuperTree(G.class));
// class io.d2a.eeee.converter.A
// └ class io.d2a.eeee.converter.B
// └ class io.d2a.eeee.converter.C
// └ class io.d2a.eeee.converter.D
// └ class io.d2a.eeee.converter.E
// └ class io.d2a.eeee.converter.G
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.2.0</version>
</dependency>
2.1.2
Changes in this release:
This release fixes a bug where you couldn't use the @Use
annotation for Entrypoint generation.
@Entrypoint
public void run (
@Generate @Use(NameGenerator.class)
final String[] names
) {
// ...
}
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.1.1</version>
</dependency>
2.1.0
Changes in this release:
This release allows injected and generated values in an entry-point.
You can now also set the @Inject
-annotation create
-attribute to true
, which initialises a new instance of the class with injected values.
In addition, there is now the utility method StringConverter#repeat
to repeat a CharSequence n times:
StringConverter.repeat("-", 1); // -
StringConverter.repeat("-", 5); // -----
StringConverter.repeat("-", 10); // ----------
Examples
Generate in Entrypoint
@Entrypoint
public void run(
@Generate @Fill(10) final int[] numbers, // generate 10 random numbers
@Generate @Fill(10) @Range({0, 100, 10}) final int[] numbers, // generate 10 random numbers from 0 to 10 with steps of 10
) {
System.out.println(Arrays.toString(numbersA));
System.out.println(Arrays.toString(numbersB));
}
// [8, 8, 8, 9, 6, 9, 5, 2, 1, 8]
// [30, 70, 40, 10, 50, 70, 30, 10, 10, 70]
Inject in Entrypoint
@Entrypoint @ForceRun
public void run(
@Inject final Scanner scanner,
@Inject(create = true) final Test test // use "create = true" to create a new instance of Test with injected values
) {
System.out.println(scanner.nextLine());
}
Combined
public static class Test {
private final Scanner scanner;
private final String name;
@Generate
public Test(@Inject final Scanner scanner, final String nameA) {
this.scanner = scanner;
this.name = nameA == null ? "injected" : nameA;
}
// ...
}
@Entrypoint(loop = true)
public void run(
@Prompt("Start?") @Default("yes") final String line,
@Inject("args") String[] args, // inject "args"
@Generate @Fill(10) final Test[] testGen, // generate 10 instances of Test
@Inject(create = true) Test testInj // initialise a new Test class with injected values
) {
System.out.println(line);
System.out.println(Arrays.toString(testGen));
System.out.println(testInj);
System.out.println(Arrays.toString(args));
}
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.1.0</version>
</dependency>
2.0.0
Changes in this release:
- In this release, the prompt queries were changed internally and some refactoring was done.
@Entrypoint(verbose = false, stopwatch = false)
is now the default behaviour.
Array Wrappers
Arrays can now be used as parameters.
The separator can be changed by the @Split
-annotation. By default, comma is used.
Note: The individual values cannot yet be checked in this release (e.g. by Range).
@Entrypoint
public void run(
@Split(",") final int[] numbers
) {
System.out.println(Arrays.toString(numbers));
}
// [arr<int>] arg0: 0,1,2,3
// [0, 1, 2, 3]
@Transform
and @Range
can be used on arrays:
@Entrypoint
public void run(
@Split(",") @Range({2, 3}) @Transform(Type.UPPER)
final String[] names
) {
System.out.println(Arrays.toString(names));
}
// [arr<String>] /,/ arg0: simon // @Range not satisfied
// [arr<String>] /,/ arg0: simon,thorsten
// [SIMON, THORSTEN]
@Pattern
The @Pattern
annotation was implemented, which can be used to check strings for a RegEx-pattern:
@Entrypoint
public void run(
@Pattern("^[A-Ha-h]{6}$") final String input
) {
System.out.println(input);
}
// input "AbCdEfG" allowed
// input "AAAA" not allowed
// input "AbDgHi" not allowed
loop
Entrypoint
The @Entrypoint
annotation now includes a loop
-attribute. If this is set to true
, the method is executed in a permanent loop.
@Entrypoint(loop = true)
public void run(
@Pattern("^[A-Ha-h]{6}$") final String input
) {
System.out.println(input);
}
// arg0: AAAAAA
// AAAAAA
// arg0: BBBBBB
// BBBBBB
Contributors
- @darmiel
- @Luca-Hackl #3 (new contributor! 🎉)
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.0.0</version>
</dependency>