Guava Supplier - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava Supplier class.

This code example shows how to use the following methods:get
   } 
 
   @Override 
   public OrgAndName apply(NodeMetadata from) {
      if (from.getGroup() != null) {
         Org org = client.findOrgNamed(vdcToOrg.get().get(from.getLocation().getId()));
         if (org == null) {
            logger.warn("did not find an association for vdc %s in %s", from.getLocation().getId(), vdcToOrg);
         } else { 
            return new OrgAndName(org.getHref(), from.getGroup());
         } 
      } 
      return null; 
   } 
} 
8
CodeRank
This code example shows how to use the following methods:get
    } 
 
    public T poll(Supplier<T> supplier) {
        T bb = super.poll();
        if (bb == null) {
            return supplier.get();
        } 
        return bb;
    } 
} 
8
CodeRank
This code example shows how to use the following methods:get
      this.zoneIdToURIs = zoneIdToURIs;
   } 
 
   @Override 
   public Set<String> get() {
      return zoneIdToURIs.get().keySet();
   } 
} 
8
CodeRank
This code example shows how to use the following methods:get
 
         }); 
          
      } else { 
         imageMap = CacheBuilder.newBuilder().build(CacheLoader.from(Functions.forMap(
                  ImagesToRegionAndIdMap.imagesToMap(images.get()))));
      } 
 
      return new EC2TemplateBuilderImpl(locations, new ImageCacheSupplier(images, 60), sizes, Suppliers.ofInstance(defaultLocation),
            optionsProvider, templateBuilderProvider, getImageStrategy, Suppliers.<LoadingCache<RegionAndName, ? extends Image>>ofInstance(imageMap));
   } 
 
   @Override 
   protected String getProviderFormatId(String uniqueLabel) {
       return "us-east-1/" + uniqueLabel;
   } 
 
   @Override 
   @Test
   public void testHardwareWithImageIdPredicateOnlyAcceptsImageWhenLocationNull() { 
7
CodeRank
This code example shows how to use the following methods:get
      this.dateProvider = dateProvider;
   } 
 
   @Override 
   public HttpRequest filter(HttpRequest request) throws HttpException {
      return request.toBuilder().replaceQueryParam("now", dateProvider.get().getTime() + "").build();
   } 
 
} 
8
CodeRank
This code example shows how to use the following methods:get
      this.regionToEndpoints = regionToEndpoints;
   } 
 
   @Override 
   public URI apply(Object from) {
      Map<String, Supplier<URI>> regionToEndpoint = regionToEndpoints.get();
      checkState(!regionToEndpoint.isEmpty(), "no region name to endpoint mappings configured!");
      checkArgument(regionToEndpoint.containsKey(from),
               "requested location %s, which is not a configured region: %s", from, regionToEndpoint);
      return regionToEndpoint.get(from).get();
   } 
} 
8
CodeRank
This code example shows how to use the following methods:get
      this.zoneToEndpoints = zoneToEndpoints;
   } 
 
   @Override 
   public URI apply(Object from) {
      Map<String, Supplier<URI>> zoneToEndpoint = zoneToEndpoints.get();
      checkState(!zoneToEndpoint.isEmpty(), "no zone name to endpoint mappings configured!");
      checkArgument(zoneToEndpoint.containsKey(from),
               "requested location %s, which is not a configured zone: %s", from, zoneToEndpoint);
      return zoneToEndpoint.get(from).get();
   } 
} 
8
CodeRank
This code example shows how to use the following methods:get
   } 
 
   @Override 
   public Set<String> get() {
      try { 
         return regionIdToURIs.get().keySet();
      } catch (UndeclaredThrowableException e) {
         throw propagate(e.getCause());
      } 
   } 
} 
8
CodeRank
This code example shows how to use the following methods:get
 
   public T get() { 
      if (authException.get() != null)
         throw authException.get();
      try { 
         return delegate.get();
      } catch (AuthorizationException e) {
         authException.set(e);
         throw e;
      } catch (Exception e) {
         AuthorizationException aex = getFirstThrowableOfType(e, AuthorizationException.class);
         if (aex != null) {
            authException.set(aex);
            throw aex;
         } 
         throw propagate(e);
      } 
   } 
 
   @Override 
7
CodeRank
This code example shows how to use the following methods:get
      enqueueRegions("us-east-1", "eu-central-1"); 
 
      Map<String, Supplier<URI>> result = supplier(new Properties()).get();
 
      assertEquals(result.size(), 2);
      assertNotNull(result.get("us-east-1").get());
      assertNotNull(result.get("eu-central-1").get());
 
      assertPosted("us-east-1", "Action=DescribeRegions"); 
   } 
 
   public void honorsRegionWhitelist() throws Exception {
      enqueueRegions("us-east-1", "eu-central-1"); 
 
      Properties overrides = new Properties();
      overrides.setProperty(PROPERTY_REGIONS, "us-east-1");
 
      Map<String, Supplier<URI>> result = supplier(overrides).get();
 
      assertEquals(result.size(), 1);
7
CodeRank
See Code Examples for Guava Supplier Methods: