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.arpnetworking.tsdcore.tailer.NoPositionStore.java

/**
 * {@inheritDoc}
 */
@Override
public Optional<Long> getPosition(final String identifier) {
    return Optional.absent();
}

From source file:org.eclipse.recommenders.codesearch.rcp.index.indexer.utils.IndexInformationCache.java

@Override
public Optional<Long> getLastIndexed(final File location) {
    if (cache.containsKey(location)) {
        return Optional.of(cache.get(location));
    }/*from  w w w  .j  a  v  a2  s  . c o  m*/

    return Optional.absent();
}

From source file:org.eclipse.buildship.core.util.file.FileUtils.java

/**
 * Derives a {@code File} instance with absolute path from the specified path.
 *
 * @param path the relative or absolute path of the {@code File} instance to derive
 * @return the absolute {@code File} if the path is not {@code null} or empty, otherwise
 * {@link Optional#absent()}/* w w  w . j a v  a 2 s.  c o m*/
 */
public static Optional<File> getAbsoluteFile(String path) {
    if (Strings.isNullOrEmpty(path)) {
        return Optional.absent();
    } else {
        return Optional.of(new File(path.trim()).getAbsoluteFile());
    }
}

From source file:com.aegiswallet.widgets.AegisTypeface.java

public static Optional<Typeface> createTypeface(TextView widget, Optional<Font> option) {
    if (widget.isInEditMode()) {
        return Optional.absent();
    }/*from w  w  w  .  j  a va  2 s . c om*/
    synchronized (TYPEFACES) {
        Font font = option.or(Font.regular);
        Typeface typeface = TYPEFACES.get(font);
        if (typeface == null) {
            typeface = Typeface.createFromAsset(widget.getContext().getAssets(), getAssetPath(font));
            TYPEFACES.put(font, typeface);
        }
        // This is never null at runtime, but roboelectric cannot create typefaces so it is null during tests
        return Optional.fromNullable(typeface);
    }
}

From source file:org.opendaylight.controller.md.sal.binding.spi.AdapterLoader.java

@Override
public Optional<T> load(final Class<? extends T> key) {

    final AdapterBuilder<? extends T, D> builder = createBuilder(key);
    for (final Class<? extends D> reqDeleg : builder.getRequiredDelegates()) {
        final D deleg = getDelegate(reqDeleg);
        if (deleg != null) {
            builder.addDelegate(reqDeleg, deleg);
        } else {/* w  w w.  j a  va 2  s . com*/
            return Optional.absent();
        }
    }
    return Optional.<T>of(builder.build());
}

From source file:org.mayocat.jackson.OptionalStringDeserializer.java

@Override
public Optional<String> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
        throws IOException, JsonProcessingException {
    if (Strings.isNullOrEmpty(jsonParser.getValueAsString())) {
        return Optional.absent();
    }//from  ww w .j  a  v  a  2  s . co m
    return Optional.fromNullable(jsonParser.getValueAsString());
}

From source file:org.eclipse.emf.ecoretools.design.service.DiagnosticAttachment.java

public static Optional<Diagnostic> get(EObject cur) {
    DiagnosticAttachment found = getAttachment(cur);
    if (found != null) {
        return Optional.fromNullable(found.getDiagnostic());
    }// w  w w  . j  a va 2  s.  com
    return Optional.absent();
}

From source file:org.opendaylight.controller.config.yang.store.impl.YangStoreActivator.java

@Override
public void start(BundleContext context) throws Exception {
    // get blacklist
    Optional<Pattern> maybeBlacklistPattern = Optional.absent();
    String blacklist = context.getProperty("yangstore.blacklist");
    if (blacklist != null) {
        try {//w w w  .ja  v  a2 s .c  o m
            maybeBlacklistPattern = Optional.of(Pattern.compile(blacklist));
        } catch (RuntimeException e) {
            logger.error("Cannot parse blacklist regex " + blacklist, e);
            throw e;
        }
    }
    ExtenderYangTracker extenderYangTracker = new ExtenderYangTracker(maybeBlacklistPattern, context);
    Dictionary<String, ?> properties = new Hashtable<>();
    context.registerService(YangStoreService.class, extenderYangTracker, properties);
}

From source file:extrabiomes.Module.java

public static void releaseStaticResources() {
    eventBus = Optional.absent();
}

From source file:de.flapdoodle.javaparser.parboiled.helper.EmptyParameter.java

@Override
protected Optional<Parameter> asParameter() {
    return Optional.absent();
}