List of usage examples for java.util Optional map
public <U> Optional<U> map(Function<? super T, ? extends U> mapper)
From source file:org.wso2.carbon.uuf.core.App.java
private Theme getRenderingTheme(API api) { Optional<String> sessionThemeName = api.getSession().map(Session::getThemeName); if (!sessionThemeName.isPresent()) { return defaultTheme; }/*w ww . j a v a 2 s. c om*/ return sessionThemeName.map(themes::get) .orElseThrow(() -> new IllegalArgumentException( "Theme '" + sessionThemeName.get() + "' which is set as for the current session of app '" + name + "' does not exists. Available themes are " + themes.keySet() + ".")); }
From source file:pl.otros.logview.api.OtrosApplication.java
public Optional<LogDataTableModel> getSelectedPaneLogDataTableModel() { Optional<LogViewPanelI> selectedLogViewPanel = getSelectedLogViewPanel(); return selectedLogViewPanel.map(LogViewPanelI::getDataTableModel); }
From source file:pl.otros.logview.api.OtrosApplication.java
public Optional<JXTable> getSelectPaneJXTable() { Optional<LogViewPanelI> selectedLogViewPanel = getSelectedLogViewPanel(); return selectedLogViewPanel.map(LogViewPanelI::getTable); }
From source file:uk.nhs.fhir.render.NewMain.java
public NewMain(Path inputDirectory, Path outPath, Optional<String> newBaseURL, Optional<Set<String>> permittedMissingExtensionPrefixes, AbstractRendererEventHandler errorHandler, Optional<Set<String>> localQdomains) { this.rendererFileLocator = new DefaultRendererFileLocator(inputDirectory, makeRenderedArtefactTempDirectory(), outPath); this.newBaseURL = newBaseURL; this.permittedMissingExtensionPrefixes = permittedMissingExtensionPrefixes.orElse(Sets.newHashSet()); this.eventHandler = errorHandler; this.localQdomains = localQdomains.map(qdomains -> (Set<String>) ImmutableSet.copyOf(qdomains)); }