List of usage examples for com.google.common.base Optional of
public static <T> Optional<T> of(T reference)
From source file:appeng.items.tools.quartz.ToolQuartzCuttingKnife.java
public ToolQuartzCuttingKnife(final AEFeature type) { super(Optional.of(type.name())); this.type = type; this.setFeature(EnumSet.of(type, AEFeature.QuartzKnife)); this.setMaxDamage(50); this.setMaxStackSize(1); }
From source file:io.druid.server.router.PriorityTieredBrokerSelectorStrategy.java
@Override public Optional<String> getBrokerServiceName(TieredBrokerConfig tierConfig, Query query) { final int priority = query.getContextPriority(0); if (priority < minPriority) { return Optional.of(Iterables.getLast(tierConfig.getTierToBrokerMap().values(), tierConfig.getDefaultBrokerServiceName())); } else if (priority >= maxPriority) { return Optional.of(Iterables.getFirst(tierConfig.getTierToBrokerMap().values(), tierConfig.getDefaultBrokerServiceName())); }/*from w ww . j a va2 s . co m*/ return Optional.absent(); }
From source file:com.spotify.helios.authentication.crtauth.CrtAuthenticator.java
@Override public Optional<User> authenticate(final String token) { final String username; try {// w w w .j av a2s . co m final String[] tokenParts = token.split(":"); if (tokenParts.length == 2) { username = crtAuthServer.validateToken(tokenParts[1]); return Optional.of(new User(username)); } } catch (Exception e) { return Optional.absent(); } return Optional.absent(); }
From source file:se.sics.dozy.DozyResult.java
public DozyResult(V val) { this.status = Status.OK; this.details = Optional.absent(); this.value = Optional.of(val); }
From source file:com.brainardphotography.gravatar.GravatarProfileURL.java
public void setSize(Integer size) { Preconditions.checkNotNull(size, "'size' cannot be null"); this.size = Optional.of(new GravatarParameter("s", size.toString())); }
From source file:de.flapdoodle.soapy.config.MethodAliasBuilder.java
public MethodAliasBuilder response(TypeAlias response) { this.response = Optional.of(response); return this; }
From source file:org.sosy_lab.cpachecker.cfa.model.AStatementEdge.java
@Override public Optional<? extends AStatement> getRawAST() { return Optional.of(statement); }
From source file:org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImpl.java
public MvccEntityImpl(final Id entityId, final UUID version, final Status status, final Entity entity) { this(entityId, version, status, Optional.of(entity)); }
From source file:com.sector91.wit.routes.JsonConverter.java
@Override public Optional<T> convert(String str) { try {/*from w w w .j ava2 s. c o m*/ return Optional.of(gson.fromJson(str, type)); } catch (Exception ex) { return Optional.absent(); } }
From source file:ninja.template.TemplateEngineFreemarkerI18nMethod.java
public TemplateEngineFreemarkerI18nMethod(Messages messages, Context context, Result result) { this.messages = messages; this.context = context; this.result = Optional.of(result); }