List of usage examples for com.google.common.base Optional fromNullable
public static <T> Optional<T> fromNullable(@Nullable T nullableReference)
From source file:alluxio.util.UnixMountInfo.java
private UnixMountInfo(String deviceSpec, String mountPoint, String fsType, Options options) { mDeviceSpec = Optional.fromNullable(deviceSpec); mMountPoint = Optional.fromNullable(mountPoint); mFsType = Optional.fromNullable(fsType); mMountOptions = options;/* w w w .j a v a2 s.c o m*/ }
From source file:com.gwtplatform.dispatch.rest.rebind.parameter.HttpParameter.java
public HttpParameter(JParameter parameter, HttpParameterType type, String name, String dateFormat) { super(parameter); this.type = type; this.name = name; this.dateFormat = Optional.fromNullable(dateFormat); }
From source file:org.locationtech.geogig.plumbing.diff.DiffPathTracker.java
public Optional<Node> currentLeftTree() { return Optional.fromNullable(leftTrees.peek()); }
From source file:si.arnes.dropbookmarks.db.BookmarkDAO.java
/** * Finds a bookmark by its id./*from w w w. j a v a 2s . c o m*/ * * @param id id of a bookmark * @return a bookmark with specified id */ public Optional<Bookmark> findById(long id) { return Optional.fromNullable(get(id)); }
From source file:de.flapdoodle.javaparser.parboiled.helper.ParameterWithChild.java
@Override protected Optional<AbstractParameter> child() { return Optional.fromNullable(_child); }
From source file:google.registry.model.UpdateAutoTimestamp.java
/** Returns the timestamp, or {@link #START_OF_TIME} if it's null. */ public DateTime getTimestamp() { return Optional.fromNullable(timestamp).or(START_OF_TIME); }
From source file:se.sics.dozy.DozyResult.java
public static DozyResult ok(Object value) { return new DozyResult(Status.OK, Optional.absent(), Optional.fromNullable(value)); }
From source file:net.wouterdanes.docker.provider.model.BuiltImageInfo.java
public BuiltImageInfo(final String imageId, ImageBuildConfiguration imageConfig) { this.imageId = imageId; this.startId = imageConfig.getId(); this.registry = Optional.fromNullable(imageConfig.getRegistry()); this.keepAfterStopping = imageConfig.isKeep() || imageConfig.isPush(); }
From source file:org.ctoolkit.services.endpoints.TransformerHelper.java
/** * Converts to <code>String</code> value if presented. * * @param map the map of properties taken from input JSON * @param key the JSON property as a key * @return the optional <code>String</code> value *//*from w ww.ja va 2s .c o m*/ public static Optional<String> getString(Map<String, Object> map, String key) { checkNotNull(key); return Optional.fromNullable((String) map.get(key)); }
From source file:de.zalando.hackweek.bpm.engine.impl.cassandra.db.handler.SelectTaskByIdHandler.java
@Override public Object selectOne(final Session session, final Object parameter) { final String id = (String) parameter; final Optional<Row> optionalResult = Optional.fromNullable(session.execute(QUERY, id).one()); return optionalResult.transform(TaskMapping.INSTANCE).orNull(); }