List of usage examples for com.google.common.base Optional fromNullable
public static <T> Optional<T> fromNullable(@Nullable T nullableReference)
From source file:org.locationtech.geogig.repository.Hints.java
public Optional<Serializable> get(final String key) { return Optional.fromNullable(hintsMap.get(key)); }
From source file:de.flapdoodle.logparser.stacktrace.StackLines.java
public Optional<More> more() { return Optional.fromNullable(_more); }
From source file:com.technostar98.tcbot.bot.BotManager.java
public static Optional<ChannelManager> getChannelManager(String server, String channel) { return Optional.fromNullable(getBotOutputPipe(server).getChannelManager(channel)); }
From source file:ws.moor.swissvault.auth.AuthModule.java
@Provides @RequestScoped//from w ww .j a v a2 s .c o m @AuthenticatedUser private Optional<UserId> provideUserId(AuthCookieFactory cookieFactory, HttpServletRequest request) { return Optional.fromNullable(cookieFactory.extractUserId(request)); }
From source file:org.opendaylight.faas.fabric.general.FabricInstanceCache.java
Optional<UnderlayerNetworkType> getFabricType(FabricId fabricId) { Optional<FabricInstance> instance = Optional.fromNullable(cache.get(fabricId)); if (instance.isPresent()) { return Optional.of(instance.get().getType()); } else {/*w ww . j av a2 s. co m*/ return Optional.absent(); } }
From source file:org.onosproject.store.flow.ReplicaInfo.java
/** * Creates a ReplicaInfo instance.//w w w .j a v a2 s . c om * * @param master NodeId of the node where the master copy should be * @param backups list of NodeId, where backup copies should be placed */ public ReplicaInfo(NodeId master, List<NodeId> backups) { this.master = Optional.fromNullable(master); this.backups = checkNotNull(backups); }
From source file:org.apache.aurora.scheduler.async.TaskGroup.java
synchronized Optional<String> peek() { return Optional.fromNullable(tasks.peek()); }
From source file:de.flapdoodle.guava.Expectations.java
/** * gives first value, if one value exist * gives defaultValue if empty or more than one value exist, * //from ww w . j a va 2s. com * @param values * @return value */ public static <T> T oneIfOnlyOne(Iterator<T> iterator, T defaultValue) { return noneOrOneIfOnlyOne(iterator).or(Optional.fromNullable(defaultValue)).orNull(); }
From source file:ninja.leaping.configurate.commented.SimpleCommentedConfigurationNode.java
@Override public Optional<String> getComment() { return Optional.fromNullable(comment); }
From source file:org.geogit.api.RevPerson.java
/** * @return the email */ public Optional<String> getEmail() { return Optional.fromNullable(email); }