Skip to content

Commit

Permalink
Merge pull request #1 from theborakompanioni/tbk/single-service-by-class
Browse files Browse the repository at this point in the history
call delegate '#getService()' when looking up single service
  • Loading branch information
theborakompanioni authored Dec 5, 2020
2 parents 9f64034 + dd4cc06 commit 2664c9a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/main/java/javax/money/spi/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,14 @@ public static <T> Collection<T> getServices(Class<T> serviceType) {
}

/**
* Delegate method for {@link ServiceProvider#getServices(Class)}.
* Delegate method for {@link ServiceProvider#getService(Class)}.
*
* @param serviceType the service type.
* @return the service found, or {@code null}.
* @see ServiceProvider#getServices(Class)
*/
public static <T> T getService(Class<T> serviceType) {
List<T> services = getServiceProvider().getServices(serviceType);
return services
.stream()
.findFirst()
.orElse(null);
return getServiceProvider().getService(serviceType);
}

}

0 comments on commit 2664c9a

Please sign in to comment.