Skip to content

Commit

Permalink
rename loader
Browse files Browse the repository at this point in the history
  • Loading branch information
SentryMan committed Jun 17, 2024
1 parent 3f0ad72 commit 22a1947
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/** Default implementation of Validator. */
final class DValidator implements Validator, ValidationContext {

private static final DServiceLoader SPI_LOADER = new DServiceLoader();
private static final ExtensionLoader SPI_LOADER = new ExtensionLoader();
private final CoreAdapterBuilder builder;
private final Map<Type, ValidationType<?>> typeCache = new ConcurrentHashMap<>();
private final MessageInterpolator interpolator;
Expand Down Expand Up @@ -289,7 +289,7 @@ private void registerComponents() {
for (final ValidatorCustomizer next : SPI_LOADER.customizers()) {
next.customize(this);
}
for (final GeneratedComponent next : SPI_LOADER.components()) {
for (final GeneratedComponent next : SPI_LOADER.generatedComponents()) {
next.customize(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
import io.avaje.validation.spi.ValidationExtension;

/** Load all the services using the common service interface. */
final class DServiceLoader {
final class ExtensionLoader {

private final List<GeneratedComponent> components = new ArrayList<>();
private final List<GeneratedComponent> generatedComponents = new ArrayList<>();
private final List<ValidatorCustomizer> customizers = new ArrayList<>();
private final List<AdapterFactory> adapterFactories = new ArrayList<>();
private final List<AnnotationFactory> annotationFactories = new ArrayList<>();
private Optional<MessageInterpolator> interpolator = Optional.empty();

DServiceLoader() {
ExtensionLoader() {
for (var spi : ServiceLoader.load(ValidationExtension.class)) {
if (spi instanceof GeneratedComponent gc) {
components.add(gc);
generatedComponents.add(gc);
} else if (spi instanceof ValidatorCustomizer c) {
customizers.add(c);
} else if (spi instanceof MessageInterpolator m) {
Expand All @@ -41,8 +41,8 @@ public Optional<MessageInterpolator> interpolator() {
return interpolator;
}

public List<GeneratedComponent> components() {
return components;
public List<GeneratedComponent> generatedComponents() {
return generatedComponents;
}

public List<ValidatorCustomizer> customizers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import io.avaje.spi.Service;

/** super interface for all Validation SPIs */
/** Super interface for all validation SPIs */
@Service
public sealed interface ValidationExtension
permits AdapterFactory,
Expand Down

0 comments on commit 22a1947

Please sign in to comment.