List of usage examples for com.google.common.base Optional of
public static <T> Optional<T> of(T reference)
From source file:org.opendaylight.controller.netconf.cli.io.BaseConsoleContext.java
@Override public Optional<String> getPrompt() { return Optional.of(dataSchemaNode.getQName().getLocalName()); }
From source file:org.impressivecode.depress.matcher.syntacticanalysis.Configuration.java
public Configuration(final SettingsModelString regExpKeywords, final SettingsModelString keywords, final SettingsModelString onlyIds) { if (emptyToNull(regExpKeywords.getStringValue()) != null) { this.keywordsRegexp = Optional.of(Pattern.compile(regExpKeywords.getStringValue())); } else {/*from w w w.j a v a2 s. c o m*/ this.keywordsRegexp = Optional.absent(); } if (emptyToNull(keywords.getStringValue()) != null) { Set<String> set = Sets.newHashSet(keywords.getStringValue().split(",")); this.keywords = Optional.of(set); } else { this.keywords = Optional.absent(); } if (emptyToNull(onlyIds.getStringValue()) != null) { this.onlyNumbers = Optional.of(Pattern.compile(onlyIds.getStringValue(), Pattern.MULTILINE)); } else { this.onlyNumbers = Optional.absent(); } }
From source file:bear.task.DependencyResult.java
private void createIfNotPresent() { if (!messages.isPresent()) messages = Optional.of(new ArrayList<String>()); }
From source file:io.crate.sql.tree.AlterTable.java
public AlterTable(Table table, GenericProperties genericProperties) { this.table = table; this.genericProperties = Optional.of(genericProperties); this.resetProperties = ImmutableList.of(); }
From source file:appeng.items.tools.quartz.ToolQuartzSpade.java
public ToolQuartzSpade(final AEFeature type) { super(ToolMaterial.IRON); this.handler = new ItemFeatureHandler(EnumSet.of(this.type = type, AEFeature.QuartzSpade), this, this, Optional.of(type.name())); }
From source file:com.hpe.adm.octane.ideplugins.intellij.util.NotificationBuilder.java
public NotificationBuilder listener(NotificationListener listener) { this.listener = Optional.of(listener); return this; }
From source file:extrabiomes.module.amica.buildcraft.BuildcraftPlugin.java
@ForgeSubscribe public void preInit(PluginEvent.Pre event) { if (!Extrabiomes.proxy.isModLoaded("BuildCraft|Energy")) { return;/*from www .j av a2 s . com*/ } //LogHelper.fine(Extrabiomes.proxy.getStringLocalization(LOG_MESSAGE_PLUGIN_INIT), MOD_NAME); LogHelper.fine("Initializing %s plugin.", MOD_NAME); try { api = Optional.of(new BuildcraftAPI()); } catch (final Exception ex) { ex.printStackTrace(); //LogHelper.fine(Extrabiomes.proxy.getStringLocalization(LOG_MESSAGE_PLUGIN_ERROR), MOD_NAME); LogHelper.fine("Could not communicate with %s. Disabling plugin.", MOD_NAME); api = Optional.absent(); } }
From source file:info.rynkowski.hamsterclient.domain.interactors.StopFactUseCase.java
@Override protected @Nonnull Observable<Void> buildUseCaseObservable(@Nonnull Fact fact) { if (fact.getEndTime().isPresent()) { return Observable.error(new AssertionError("The fact has already stopped.")); }//from www. ja v a2s. c om return Observable.just( // new Fact.Builder(fact) // .endTime(Optional.of(GregorianCalendar.getInstance())) // .build()) .flatMap(hamsterRepository::updateFact).flatMap(id -> Observable.<Void>empty()); }
From source file:com.dangdang.ddframe.rdb.sharding.executor.wrapper.StatementExecutorWrapper.java
public StatementExecutorWrapper(final Statement statement, final SQLExecutionUnit sqlExecutionUnit) { super(sqlExecutionUnit); this.statement = statement; if (isDML()) { dmlExecutionEvent = Optional.of( new DMLExecutionEvent(getSqlExecutionUnit().getDataSource(), getSqlExecutionUnit().getSql())); dqlExecutionEvent = Optional.absent(); } else if (isDQL()) { dqlExecutionEvent = Optional.of( new DQLExecutionEvent(getSqlExecutionUnit().getDataSource(), getSqlExecutionUnit().getSql())); dmlExecutionEvent = Optional.absent(); } else {/*from www.j av a 2 s.co m*/ dmlExecutionEvent = Optional.absent(); dqlExecutionEvent = Optional.absent(); } }
From source file:com.google.errorprone.matchers.method.InstanceMethodMatcherImpl.java
@Override protected Optional<MatchState> matchResult(ExpressionTree item, MatchState method, VisitorState state) { if (method.sym().isStatic()) { return Optional.absent(); }// w ww .jav a 2 s. co m return Optional.of(method); }