Created
June 20, 2017 15:22
-
-
Save feoktant/d0cef407d82deb48d7a2b2dea69cb8da to your computer and use it in GitHub Desktop.
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
public WebConferenceProvider resolve(String providerId) { | |
VideoProviderEntity providerEntity = VideoProviderEntity.findById(providerId).orElseThrow(() -> | |
new ServiceInternalException("Cannot resolve provider with id: " + providerId) | |
); | |
return applicationContext.getBean(providerEntity.getProviderClass()); | |
} | |
public static Optional<VideoProviderEntity> findById(String providerId) { | |
return Stream.of(VideoProviderEntity.values()) | |
.filter(x -> x.getId().equals(providerId)) | |
.findFirst(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment