1515/** Load all the services using the common service interface. */
1616final class ExtensionLoader {
1717
18- private static final List <GeneratedComponent > generatedComponents = new ArrayList <>();
19- private static final List <ValidatorCustomizer > customizers = new ArrayList <>();
20- private static final List <AdapterFactory > adapterFactories = new ArrayList <>();
21- private static final List <AnnotationFactory > annotationFactories = new ArrayList <>();
22- private static Optional <MessageInterpolator > interpolator = Optional .empty ();
18+ private final List <GeneratedComponent > generatedComponents = new ArrayList <>();
19+ private final List <ValidatorCustomizer > customizers = new ArrayList <>();
20+ private final List <AdapterFactory > adapterFactories = new ArrayList <>();
21+ private final List <AnnotationFactory > annotationFactories = new ArrayList <>();
22+ private Optional <MessageInterpolator > interpolator = Optional .empty ();
2323
24- static void init (ClassLoader classLoader ) {
24+ ExtensionLoader (ClassLoader classLoader ) {
2525 for (var spi : ServiceLoader .load (ValidationExtension .class , classLoader )) {
2626 if (spi instanceof GeneratedComponent gc ) {
2727 generatedComponents .add (gc );
@@ -37,23 +37,23 @@ static void init(ClassLoader classLoader) {
3737 }
3838 }
3939
40- static Optional <MessageInterpolator > interpolator () {
40+ Optional <MessageInterpolator > interpolator () {
4141 return interpolator ;
4242 }
4343
44- static List <GeneratedComponent > generatedComponents () {
44+ List <GeneratedComponent > generatedComponents () {
4545 return generatedComponents ;
4646 }
4747
48- static List <ValidatorCustomizer > customizers () {
48+ List <ValidatorCustomizer > customizers () {
4949 return customizers ;
5050 }
5151
52- static List <AdapterFactory > adapterFactories () {
52+ List <AdapterFactory > adapterFactories () {
5353 return adapterFactories ;
5454 }
5555
56- static List <AnnotationFactory > annotationFactories () {
56+ List <AnnotationFactory > annotationFactories () {
5757 return annotationFactories ;
5858 }
5959}
0 commit comments