Example usage for com.google.common.base Optional fromNullable

List of usage examples for com.google.common.base Optional fromNullable

Introduction

In this page you can find the example usage for com.google.common.base Optional fromNullable.

Prototype

public static <T> Optional<T> fromNullable(@Nullable T nullableReference) 

Source Link

Document

If nullableReference is non-null, returns an Optional instance containing that reference; otherwise returns Optional#absent .

Usage

From source file:org.apache.jclouds.profitbricks.rest.domain.Trackable.java

public void setRequestStatusUri(@Nullable URI requestStatusUri) {
    this.requestStatusUri = Optional.fromNullable(requestStatusUri);
}

From source file:com.gwtplatform.processors.tools.bindings.gin.GinBinding.java

public GinBinding(Type implementer, Type implemented, Type scope, boolean eagerSingleton) {
    this.implementer = implementer;
    this.implemented = Optional.fromNullable(implemented);
    this.scope = Optional.fromNullable(eagerSingleton ? null : scope);
    this.eagerSingleton = eagerSingleton;
}

From source file:se.sics.dozy.DozyResult.java

public static DozyResult failed(Status status, String reason) {
    return new DozyResult(status, Optional.fromNullable(reason), Optional.absent());
}

From source file:ch.css.workingdiary.service.CompetenceService.java

public Optional<List<Competence>> getCompetences(final long id) {
    final List<Competence> competences = competenceDao.getCompetences(id);
    return Optional.fromNullable(competences);
}

From source file:org.opendaylight.netconf.mapping.api.HandlingPriority.java

/**
 * @return priority number or Optional.absent otherwise
 */
public Optional<Integer> getPriority() {
    return Optional.fromNullable(priority);
}

From source file:uk.co.caprica.mediascanner.domain.MediaTitle.java

/**
 *
 *
 * @param title/*from   w ww .j  a v a 2  s.  c o  m*/
 * @param year
 */
public MediaTitle(String title, Integer year) {
    this.title = title;
    this.year = Optional.fromNullable(year);
}

From source file:org.spongepowered.api.entity.living.meta.DyeColors.java

public static Optional<DyeColor> valueOf(String name) {
    return Optional.fromNullable(null);
}

From source file:com.spotify.heroic.aggregation.simple.Count.java

@JsonCreator
public Count(@JsonProperty("sampling") SamplingQuery sampling) {
    super(Optional.fromNullable(sampling).or(SamplingQuery::empty));
}

From source file:org.geogig.osm.internal.history.Change.java

public Optional<Way> getWay() {
    return Optional.fromNullable(way);
}

From source file:springfox.documentation.schema.ResolvedTypes.java

public static Optional<String> resolvedTypeSignature(ResolvedType resolvedType) {
    return Optional.fromNullable(resolvedType).transform(new Function<ResolvedType, String>() {
        @Override//from   w  ww.ja v  a 2  s . co m
        public String apply(ResolvedType input) {
            return input.getSignature();
        }
    });
}