List of usage examples for com.google.common.base Optional absent
public static <T> Optional<T> absent()
From source file:cc.ilo.cc.ilo.pipeline.prosumer.CompositeSimplePipe.java
@Override public Optional<O> process(I input) throws Exception { Optional<X> result = pipe.process(input); if (result.isPresent()) return subConsumer.process(result.get()); else//from ww w .j ava 2 s. c o m return Optional.absent(); }
From source file:se.sics.caracaldb.global.NodeStats.java
public static NodeStats deserialise(ByteBuf buf) throws IOException { Address node = (Address) SpecialSerializers.AddressSerializer.INSTANCE.fromBinary(buf, Optional.absent()); KeyRange range = CustomSerialisers.deserialiseKeyRange(buf); long storeSize = buf.readLong(); long storeNumberOfKeys = buf.readLong(); long ops = buf.readLong(); return new NodeStats(node, range, storeSize, storeNumberOfKeys, ops); }
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:com.dangdang.ddframe.rdb.sharding.parsing.parser.context.OrderItem.java
public OrderItem(final String name, final OrderType type, final Optional<String> alias) { this.owner = Optional.absent(); this.name = Optional.of(name); this.type = type; this.alias = alias; }
From source file:org.sitemap4j.sitemapindex.SiteMapLocation.java
public SiteMapLocation(final URI location, final DateTime lastModificationTime) { checkNotNull(location);//from w w w. j a v a 2 s .c o m this.location = location; if (lastModificationTime != null) { this.lastModificationTime = Optional.of(lastModificationTime); } else { this.lastModificationTime = Optional.absent(); } }
From source file:org.opendaylight.controller.netconf.cli.reader.impl.DecisionReader.java
private static ConsoleContext getContext() { return new ConsoleContext() { @Override//from w ww. j a v a2s . co m public Optional<String> getPrompt() { return Optional.absent(); } @Override public Completer getCompleter() { return new AggregateCompleter(YES_NO_COMPLETER, new StringsCompleter(IOUtil.SKIP)); } }; }
From source file:org.eclipse.mylyn.internal.wikitext.commonmark.inlines.BackslashEscapeSpan.java
@Override public Optional<? extends Inline> createInline(Cursor cursor) { char c = cursor.getChar(); if (c == '\\' && cursor.hasNext()) { if (cursor.getNext() == '\n') { return Optional.of(new HardLineBreak(cursor.getLineAtOffset(), cursor.getOffset(), 2)); } else if (ESCAPABLE.matches(cursor.getNext())) { return Optional .of(new EscapedCharacter(cursor.getLineAtOffset(), cursor.getOffset(), cursor.getNext())); }/*from ww w. j a v a2 s . c om*/ } return Optional.absent(); }
From source file:com.facebook.presto.metadata.QualifiedTablePrefix.java
public QualifiedTablePrefix(String catalogName) { this.catalogName = checkCatalogName(catalogName); this.schemaName = Optional.absent(); this.tableName = Optional.absent(); }
From source file:org.apache.gobblin.data.management.copy.replication.CopyRouteGeneratorOptimizer.java
@Override public Optional<CopyRoute> getPullRoute(ReplicationConfiguration rc, EndPoint copyTo) { if (rc.getCopyMode() == ReplicationCopyMode.PUSH) return Optional.absent(); DataFlowTopology topology = rc.getDataFlowToplogy(); List<DataFlowTopology.DataFlowPath> paths = topology.getDataFlowPaths(); for (DataFlowTopology.DataFlowPath p : paths) { List<CopyRoute> routes = p.getCopyRoutes(); if (routes.isEmpty()) { continue; }//from ww w.j a v a 2 s . c om // All routes under a path pointing to the same copyTo (replica) if (routes.get(0).getCopyTo().equals(copyTo)) { return getOptimizedCopyRoute(routes); } } return Optional.absent(); }
From source file:net.caseif.flint.common.util.helper.JsonHelper.java
public static Optional<JsonObject> readJson(File file) throws IllegalArgumentException, IOException { if (file.exists()) { try (FileReader reader = new FileReader(file)) { JsonElement el = new JsonParser().parse(reader); if (el.isJsonObject()) { return Optional.of(el.getAsJsonObject()); }/*from w ww .j a v a 2s . com*/ } } return Optional.absent(); }