List of usage examples for com.google.common.base Optional absent
public static <T> Optional<T> absent()
From source file:ec.nbdemetra.ui.tsproviders.ProvidersUtil.java
private static Optional<Node> find(DataSource dataSource, ProvidersNode node) { for (Node o : node.getChildren().getNodes()) { if (dataSource.getProviderName().equals(o.getName())) { return find(dataSource, (ProviderNode) o); }//w ww. j a v a 2 s . c om } return Optional.absent(); }
From source file:org.asoem.greyfish.utils.collect.EmptyFunctionalList.java
@Override public Optional<Object> findFirst(final Predicate<? super Object> predicate) { return Optional.absent(); }
From source file:org.apache.gobblin.data.management.copy.replication.CopyRouteGeneratorBase.java
/** * for push mode, there is no optimization *///w w w .j a va2s . co m @Override public Optional<List<CopyRoute>> getPushRoutes(ReplicationConfiguration rc, EndPoint copyFrom) { if (rc.getCopyMode() == ReplicationCopyMode.PULL) return Optional.absent(); DataFlowTopology topology = rc.getDataFlowToplogy(); List<DataFlowTopology.DataFlowPath> paths = topology.getDataFlowPaths(); for (DataFlowTopology.DataFlowPath p : paths) { /** * Routes are list of pairs that generated from config in the format of topology specification. * For example, source:[holdem, war] will end up with * List<(source, holdem), (source, war)> */ List<CopyRoute> routes = p.getCopyRoutes(); if (routes.isEmpty()) { continue; } // All the routes should has the same copyFrom but different copyTo. if (routes.get(0).getCopyFrom().equals(copyFrom)) { return Optional.of(routes); } } return Optional.absent(); }
From source file:com.github.rinde.rinsim.examples.warehouse.AGVAgent.java
AGVAgent(RandomGenerator r) { rng = r; roadModel = Optional.absent(); destination = Optional.absent(); path = new LinkedList<>(); }
From source file:info.rynkowski.hamsterclient.data.repository.datasources.dbus.entities.mapper.DbusFactMapper.java
public @Nonnull Fact transform(@Nonnull DbusFact dbusFact) { Calendar startTime = dbusFact.getStartTime().getCalendar(); Optional<Calendar> endTime = Optional.absent(); if (dbusFact.getEndTime().isPresent()) { endTime = Optional.of(dbusFact.getEndTime().get().getCalendar()); }/*from w w w .j a v a 2 s .co m*/ return new Fact.Builder() // .id(dbusFact.getId()).activity(dbusFact.getActivity()).category(dbusFact.getCategory()) .startTime(startTime).endTime(endTime).description(dbusFact.getDescription()) .tags(dbusFact.getTags()).build(); }
From source file:com.google.errorprone.matchers.method.InstanceMethodMatcherImpl.java
@Override protected Optional<MatchState> matchResult(ExpressionTree item, MatchState method, VisitorState state) { if (method.sym().isStatic()) { return Optional.absent(); }//from w ww . j a va 2 s . c o m return Optional.of(method); }
From source file:org.apache.gobblin.service.modules.orchestration.AzkabanSpecExecutor.java
public AzkabanSpecExecutor(Config config) { this(config, Optional.absent()); }
From source file:org.locationtech.geogig.plumbing.remotes.RemoteResolve.java
/** * Executes the remote-add operation./* w ww . ja va 2 s . c o m*/ * * @return the {@link Remote} that was added. */ @Override protected Optional<Remote> _call() { if (name == null || name.isEmpty()) { throw new RemoteException(StatusCode.MISSING_NAME); } Optional<Remote> result = Optional.absent(); ConfigDatabase config = configDatabase(); List<String> allRemotes = config.getAllSubsections("remote"); if (allRemotes.contains(name)) { String remoteSection = "remote." + name; Optional<String> remoteFetchURL = config.get(remoteSection + ".url"); Optional<String> remoteFetch = config.get(remoteSection + ".fetch"); Optional<String> remoteMapped = config.get(remoteSection + ".mapped"); Optional<String> remoteMappedBranch = config.get(remoteSection + ".mappedBranch"); Optional<String> remoteUserName = config.get(remoteSection + ".username"); Optional<String> remotePassword = config.get(remoteSection + ".password"); Optional<String> remotePushURL = Optional.absent(); if (remoteFetchURL.isPresent() && remoteFetch.isPresent()) { remotePushURL = config.get(remoteSection + ".pushurl"); } Remote remote = new Remote(name, remoteFetchURL.or(""), remotePushURL.or(remoteFetchURL).or(""), remoteFetch.or(""), remoteMapped.or("false").equals("true"), remoteMappedBranch.orNull(), remoteUserName.orNull(), remotePassword.orNull()); result = Optional.of(remote); } return result; }
From source file:org.eclipse.emf.eson.building.NewObjectExtensions.java
public Optional<EClass> getDeclaredOrInferredEClass(NewObject newObject) { EClass eClass = newObject.getEClass(); if (eClass == null) { Feature newObjectFeature = EcoreUtil2.getContainerOfType(newObject, Feature.class); if (newObjectFeature != null) { EStructuralFeature eFeature = newObjectFeature.getEFeature(); if (!(eFeature instanceof EReference)) return Optional.absent(); EReference eReference = (EReference) eFeature; eClass = eReference.getEReferenceType(); } else {/*from ww w . ja v a2s . co m*/ // Do NOT logger.error here! return Optional.absent(); } } if (eClass.getEPackage() == null) { EcoreUtil.resolve(newObject.eClass(), newObject); } if (eClass.eIsProxy()) { if (logger.isDebugEnabled()) logger.debug("The EClass for NewObject " + getNewObjectDescriptionForErrorMessage(newObject) + " is still an unresolved EMF Proxy, something isn't working in your cross-Resource reference resolution"); return Optional.absent(); } EPackage ePackage = eClass.getEPackage(); if (ePackage == null) { logger.error("No EPackage registered for EClass '" + eClass.getName() + "' defined in NewObject " + getNewObjectDescriptionForErrorMessage(newObject)); return Optional.absent(); } return Optional.of(eClass); }
From source file:org.geogit.api.porcelain.RemoteResolve.java
/** * Executes the remote-add operation.// w w w .j a v a2s . co m * * @return the {@link Remote} that was added. */ @Override public Optional<Remote> call() { if (name == null || name.isEmpty()) { throw new RemoteException(StatusCode.MISSING_NAME); } Optional<Remote> result = Optional.absent(); List<String> allRemotes = config.getAllSubsections("remote"); if (allRemotes.contains(name)) { String remoteSection = "remote." + name; Optional<String> remoteFetchURL = config.get(remoteSection + ".url"); Optional<String> remoteFetch = config.get(remoteSection + ".fetch"); Optional<String> remoteMapped = config.get(remoteSection + ".mapped"); Optional<String> remoteMappedBranch = config.get(remoteSection + ".mappedBranch"); if (remoteFetchURL.isPresent() && remoteFetch.isPresent()) { Optional<String> remotePushURL = config.get(remoteSection + ".pushurl"); Remote remote = new Remote(name, remoteFetchURL.get(), remotePushURL.or(remoteFetchURL.get()), remoteFetch.get(), remoteMapped.or("false").equals("true"), remoteMappedBranch.orNull()); result = Optional.of(remote); } } return result; }