Skip to content

Commit

Permalink
ServiceHelper refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille committed Dec 19, 2023
1 parent f6040c1 commit 2eb0811
Showing 1 changed file with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.ServiceLoader;

import io.github.mmm.base.exception.ObjectNotFoundException;
import io.github.mmm.base.service.ServiceHelper;
import io.github.mmm.marshall.StructuredFormatFactory;
import io.github.mmm.marshall.StructuredFormatProvider;

Expand All @@ -29,21 +30,8 @@ protected StructuredFormatFactoryImpl() {

super();
this.providerMap = new HashMap<>();
ServiceLoader<StructuredFormatProvider> serviceLoader = ServiceLoader.load(StructuredFormatProvider.class);
for (StructuredFormatProvider provider : serviceLoader) {
register(provider);
}
}

/**
* @param provider the {@link StructuredFormatProvider} to register.
*/
public void register(StructuredFormatProvider provider) {

StructuredFormatProvider duplicate = this.providerMap.put(provider.getId(), provider);
if (duplicate != null) {

}
ServiceHelper.all(ServiceLoader.load(StructuredFormatProvider.class), this.providerMap,
StructuredFormatProvider::getId);
}

@Override
Expand Down

0 comments on commit 2eb0811

Please sign in to comment.