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

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

Introduction

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

Prototype

public static <T> Optional<T> absent() 

Source Link

Document

Returns an Optional instance with no contained reference.

Usage

From source file:com.dangdang.ddframe.rdb.sharding.parser.result.merger.OrderByColumn.java

public OrderByColumn(final String name, final OrderByType orderByType) {
    super(Optional.<String>absent(), Optional.of(name), Optional.<String>absent(), orderByType);
    index = Optional.absent();
}

From source file:org.opendaylight.controller.cluster.datastore.entityownership.AbstractEntityOwnerChangeListener.java

void init(final ShardDataTree shardDataTree) {
    shardDataTree.registerTreeChangeListener(EOS_PATH, this, Optional.absent(), noop -> {
        /* NOOP */ });
}

From source file:org.geogit.api.plumbing.LsRemote.java

/**
 * Constructs a new {@code LsRemote}.//from   w  w w  .j a va  2 s. c om
 */
@Inject
public LsRemote(Repository repository, DeduplicationService deduplicationService) {
    Optional<Remote> abstent = Optional.absent();
    this.remote = Suppliers.ofInstance(abstent);
    this.getHeads = true;
    this.getTags = true;
    this.localRepository = repository;
    this.deduplicationService = deduplicationService;
}

From source file:com.android.camera.one.v1.LegacyOneCameraManagerImpl.java

public static Optional<LegacyOneCameraManagerImpl> instance() {
    if (INSTANCE != null) {
        return INSTANCE;
    }//from   w  w  w  . j  a v a  2  s.  c  om

    int numberOfCameras;
    Camera.CameraInfo[] cameraInfos;
    try {
        numberOfCameras = Camera.getNumberOfCameras();
        cameraInfos = new Camera.CameraInfo[numberOfCameras];
        for (int i = 0; i < numberOfCameras; i++) {
            cameraInfos[i] = new Camera.CameraInfo();
            Camera.getCameraInfo(i, cameraInfos[i]);
        }
    } catch (RuntimeException ex) {
        Log.e(TAG, "Exception while creating CameraDeviceInfo", ex);
        return Optional.absent();
    }

    int firstFront = NO_DEVICE;
    int firstBack = NO_DEVICE;
    // Get the first (smallest) back and first front camera id.
    for (int i = numberOfCameras - 1; i >= 0; i--) {
        if (cameraInfos[i].facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
            firstBack = i;
        } else {
            if (cameraInfos[i].facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
                firstFront = i;
            }
        }
    }

    CameraId frontCameraId = firstFront >= 0 ? CameraId.fromLegacyId(firstFront) : null;
    CameraId backCameraId = firstBack >= 0 ? CameraId.fromLegacyId(firstBack) : null;

    LegacyOneCameraManagerImpl cameraManager = new LegacyOneCameraManagerImpl(backCameraId, frontCameraId,
            cameraInfos);
    INSTANCE = Optional.of(cameraManager);
    return INSTANCE;
}

From source file:com.google.errorprone.matchers.method.ConstructorMatcherImpl.java

@Override
protected Optional<MatchState> matchResult(ExpressionTree tree, VisitorState state) {
    MethodSymbol sym = getConstructor(tree);
    if (sym == null) {
        return Optional.absent();
    }/*from   www  .  j a  va 2  s  .  c o m*/
    return Optional.of(MatchState.create(sym.owner.type, sym));
}

From source file:se.sics.ktoolbox.util.SerializerHelper.java

public static <V extends Object> Map<String, V> sKMFromBinary(Class<V> vClass, ByteBuf buf) {
    int nrE = buf.readInt();
    Map<String, V> map = new TreeMap<>();
    for (int i = 0; i < nrE; i++) {
        String mapKey = SerializerHelper.stringFromBinary(buf);
        V mapValue = (V) Serializers.lookupSerializer(vClass).fromBinary(buf, Optional.absent());
        map.put(mapKey, mapValue);/*from ww w. j  a  v a2 s . c  om*/
    }
    return map;
}

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

public static DozyResult timeout() {
    return new DozyResult(Status.TIMEOUT, Optional.absent());
}

From source file:org.sonar.server.computation.qualitygate.ConditionEvaluator.java

private static Optional<EvaluationResult> evaluateCondition(Condition condition,
        Comparable<?> measureComparable, Measure.Level alertLevel) {
    String conditionValue = getValueToEval(condition, alertLevel);
    if (StringUtils.isEmpty(conditionValue)) {
        return Optional.absent();
    }/*ww  w  .j  av a2 s.  com*/

    try {
        Comparable conditionComparable = parseConditionValue(condition.getMetric(), conditionValue);
        if (doesReachThresholds(measureComparable, conditionComparable, condition)) {
            return of(new EvaluationResult(alertLevel, measureComparable));
        }
        return Optional.absent();
    } catch (NumberFormatException badValueFormat) {
        throw new IllegalArgumentException(
                String.format("Quality Gate: Unable to parse value '%s' to compare against %s", conditionValue,
                        condition.getMetric().getName()));
    }
}

From source file:com.palantir.common.remoting.ServiceNotAvailableException.java

public ServiceNotAvailableException(String message, Throwable cause) {
    super(message, cause);
    this.serviceHint = Optional.absent();
}

From source file:com.github.rinde.rinsim.experiment.DefaultMASConfiguration.java

@Override
public Optional<? extends Creator<AddDepotEvent>> getDepotCreator() {
    return Optional.absent();
}