add kontor-javalin
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":models") // <-- add dependency to models subproject
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package de.thpeetz.kontor.services.api;
|
||||
|
||||
import de.thpeetz.kontor.models.Person;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PersonReader {
|
||||
List<Person> getAll();
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package de.thpeetz.kontor.services.inmemory;
|
||||
|
||||
import de.thpeetz.kontor.models.Person;
|
||||
import java.util.List;
|
||||
|
||||
import de.thpeetz.kontor.services.api.PersonReader;
|
||||
|
||||
public class InMemoryPersonReader implements PersonReader {
|
||||
@Override
|
||||
public List<Person> getAll() {
|
||||
return List.of(
|
||||
new Person("Vincent Vega", 73),
|
||||
new Person("Jules Winnfield", 12));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import de.thpeetz.kontor.services.api.PersonReader;
|
||||
import de.thpeetz.kontor.services.inmemory.InMemoryPersonReader;
|
||||
|
||||
module de.thpeetz.kontor.services {
|
||||
exports de.thpeetz.kontor.services.api;
|
||||
|
||||
requires de.thpeetz.kontor.models;
|
||||
|
||||
// We're telling the ServiceLoader that the InMemoryPersonReader provides the implementation for the PersonReader interface
|
||||
provides PersonReader with InMemoryPersonReader;
|
||||
}
|
||||
Reference in New Issue
Block a user