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.parsing.parser.dialect.sqlserver.SQLServerParser.java

@Override
protected boolean isRowNumberCondition(final SelectStatement selectStatement, final String columnLabel) {
    Optional<String> rowNumberAlias = Optional.absent();
    for (SelectItem each : selectStatement.getItems()) {
        if (each.getAlias().isPresent() && "ROW_NUMBER".equalsIgnoreCase(each.getExpression())) {
            rowNumberAlias = each.getAlias();
        }//w  ww  .  j  av  a2 s .co m
    }
    return columnLabel.equalsIgnoreCase(rowNumberAlias.orNull());
}

From source file:org.opendaylight.netconf.test.tool.FakeCapability.java

/**
 l*/*  w ww  .ja  v a 2 s .c  o m*/
 * @return empty schema source to trigger schema resolution exception.
 */
@Override
public Optional<String> getCapabilitySchema() {
    return Optional.absent();
}

From source file:com.atlassian.jira.rest.client.api.domain.OperationGroup.java

static <T> Optional<T> accept(final Iterable<? extends Operation> operations,
        final OperationVisitor<T> visitor) {
    for (Operation operation : operations) {
        Optional<T> result = operation.accept(visitor);
        if (result.isPresent()) {
            return result;
        }//from   w  ww.  j a  v a 2 s.  c om
    }
    return Optional.absent();
}

From source file:com.apothesource.pillfill.service.cache.impl.DefaultNoOpCacheServiceImpl.java

@Override
public Optional<String> getCachedData(String key) {
    return Optional.absent();
}

From source file:org.opendaylight.yangtools.yang.model.util.PatternConstraintImpl.java

PatternConstraintImpl(final String regex, final Optional<String> description,
        final Optional<String> reference) {
    this(regex, description, reference, null, null, Optional.absent());
}

From source file:qa.qcri.nadeef.core.datamodel.Violation.java

/**
 * Constructor.// ww  w .j  a va2s.  co m
 * @param ruleId rule id.
 */
public Violation(String ruleId) {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(ruleId));
    this.ruleId = ruleId;
    this.cells = Sets.newHashSet();
    this.vid = Optional.absent();
}

From source file:org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory.java

public NetconfMessageFactory() {
    clientId = Optional.absent();
}

From source file:org.apache.jclouds.oneandone.rest.handlers.OneAndOneRateLimitRetryHandler.java

@Override
protected Optional<Long> millisToNextAvailableRequest(HttpCommand command, HttpResponse response) {

    String secondsToNextAvailableRequest = response.getFirstHeaderOrNull(RETRY_AFTER_CUSTOM);
    if (secondsToNextAvailableRequest == null) {
        return Optional.absent();
    }/*from www  . j a  va 2s.  co m*/
    return Optional.of(millisUntilNextAvailableRequest(Long.parseLong(secondsToNextAvailableRequest)));

}

From source file:org.opendaylight.controller.config.facade.xml.mapping.attributes.resolving.EnumAttributeResolvingStrategy.java

@Override
public Optional<Object> parseAttribute(String attrName, Object value) throws DocumentedException {
    if (value == null) {
        return Optional.absent();
    }// w  w  w  . ja va  2 s . c o m

    Util.checkType(value, Map.class);
    Map<?, ?> valueMap = (Map<?, ?>) value;
    Preconditions.checkArgument(valueMap.size() == 1,
            "Unexpected value size " + value + " should be just 1 foe enum");
    final Object innerValue = valueMap.values().iterator().next();
    Util.checkType(innerValue, String.class);

    final String className = getOpenType().getTypeName();
    final Object parsedValue = enumResolver.fromYang(className, ((String) innerValue));

    LOG.debug("Attribute {} : {} parsed to enum type {} with value {}", attrName, innerValue, getOpenType(),
            parsedValue);
    return Optional.of(parsedValue);
}

From source file:org.cebolla.repositories.AbstractFakeRepositoryWithSimpleLookup.java

/**
 * Find an entity with the given key in the repository
 * //from   ww  w .  j  a va2  s  .  c om
 * @return an @see com.google.common.base.Optional of the entity, if found. Otherwise Optional.absent()
 */
public Optional<EntityType> lookup(Key key) {
    keysLookedUp.add(key);

    for (EntityType entity : filter(new KeyMatchPredicate(key))) {
        return Optional.of(entity);
    }

    return Optional.absent();
}