-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor SPI interfaces, use io.avaje.jsonb.spi.JsonbExtension + othe…
…r breaking changes (#246) * refactor SPI interfaces * remove hard spi dependency * cancel rename * Update pom.xml * remove generated-services registration * f * revert spi changes * remove spi from blackbox * fix meta-inf module loading * rename customize * fix services not appending * Remove @service from JsonbExtension and add some javadoc --------- Co-authored-by: Rob Bygrave <robin.bygrave@gmail.com>
- Loading branch information
Showing
24 changed files
with
153 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 7 additions & 4 deletions
11
jsonb-inject-plugin/src/main/java/io/avaje/jsonb/inject/DefaultJsonbProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
jsonb/src/main/java/io/avaje/jsonb/core/ExtensionLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.avaje.jsonb.core; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.ServiceLoader; | ||
|
||
import io.avaje.jsonb.spi.AdapterFactory; | ||
import io.avaje.jsonb.spi.GeneratedComponent; | ||
import io.avaje.jsonb.spi.JsonbComponent; | ||
import io.avaje.jsonb.spi.JsonbExtension; | ||
|
||
/** Load all the services using the common service interface. */ | ||
final class ExtensionLoader { | ||
|
||
private static final List<GeneratedComponent> generatedComponents = new ArrayList<>(); | ||
private static final List<JsonbComponent> userComponents = new ArrayList<>(); | ||
private static Optional<AdapterFactory> adapterFactory = Optional.empty(); | ||
|
||
static { | ||
for (var spi : ServiceLoader.load(JsonbExtension.class)) { | ||
if (spi instanceof GeneratedComponent) { | ||
generatedComponents.add((GeneratedComponent) spi); | ||
} else if (spi instanceof JsonbComponent) { | ||
userComponents.add((JsonbComponent) spi); | ||
} else if (spi instanceof AdapterFactory) { | ||
adapterFactory = Optional.of((AdapterFactory) spi); | ||
} | ||
} | ||
} | ||
|
||
static List<GeneratedComponent> generatedComponents() { | ||
return generatedComponents; | ||
} | ||
|
||
static List<JsonbComponent> userComponents() { | ||
return userComponents; | ||
} | ||
|
||
static Optional<AdapterFactory> adapterFactory() { | ||
return adapterFactory; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
jsonb/src/main/java/io/avaje/jsonb/spi/GeneratedComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package io.avaje.jsonb.spi; | ||
|
||
/** Component interface registers generated JsonAdapters to the Jsonb.Builder */ | ||
@FunctionalInterface | ||
public interface GeneratedComponent extends JsonbComponent, JsonbExtension {} |
Oops, something went wrong.