コード例 #1
0
ファイル: OPMLExporter.java プロジェクト: edoardoo/commafeed
  public Opml export(User user) {
    Opml opml = new Opml();
    opml.setFeedType("opml_1.1");
    opml.setTitle(String.format("%s subscriptions in CommaFeed", user.getName()));
    opml.setCreated(new Date());

    List<FeedCategory> categories = feedCategoryDAO.findAll(user);
    Collections.sort(
        categories,
        (e1, e2) ->
            MoreObjects.firstNonNull(e1.getPosition(), 0)
                - MoreObjects.firstNonNull(e2.getPosition(), 0));

    List<FeedSubscription> subscriptions = feedSubscriptionDAO.findAll(user);
    Collections.sort(
        subscriptions,
        (e1, e2) ->
            MoreObjects.firstNonNull(e1.getPosition(), 0)
                - MoreObjects.firstNonNull(e2.getPosition(), 0));

    // export root categories
    for (FeedCategory cat :
        categories.stream().filter(c -> c.getParent() == null).collect(Collectors.toList())) {
      opml.getOutlines().add(buildCategoryOutline(cat, categories, subscriptions));
    }

    // export root subscriptions
    for (FeedSubscription sub :
        subscriptions.stream().filter(s -> s.getCategory() == null).collect(Collectors.toList())) {
      opml.getOutlines().add(buildSubscriptionOutline(sub));
    }

    return opml;
  }
コード例 #2
0
  private <T> void evaluateBundle(
      final AppliedPTransform<?, ?, ?> transform,
      final CommittedBundle<T> bundle,
      final CompletionCallback onComplete) {
    TransformExecutorService transformExecutor;

    if (isKeyed(bundle.getPCollection())) {
      final StepAndKey stepAndKey = StepAndKey.of(transform, bundle.getKey());
      // This executor will remain reachable until it has executed all scheduled transforms.
      // The TransformExecutors keep a strong reference to the Executor, the ExecutorService keeps
      // a reference to the scheduled TransformExecutor callable. Follow-up TransformExecutors
      // (scheduled due to the completion of another TransformExecutor) are provided to the
      // ExecutorService before the Earlier TransformExecutor callable completes.
      transformExecutor = executorServices.getUnchecked(stepAndKey);
    } else {
      transformExecutor = parallelExecutorService;
    }

    Collection<ModelEnforcementFactory> enforcements =
        MoreObjects.firstNonNull(
            transformEnforcements.get(transform.getTransform().getClass()),
            Collections.<ModelEnforcementFactory>emptyList());

    TransformExecutor<T> callable =
        TransformExecutor.create(
            evaluationContext,
            registry,
            enforcements,
            bundle,
            transform,
            onComplete,
            transformExecutor);
    outstandingWork.incrementAndGet();
    transformExecutor.schedule(callable);
  }
コード例 #3
0
 public long calculate(
     DefaultIssue issue, Collection<IssueChangeDto> debtChangelog, Period period) {
   if (issue.creationDate().getTime() > period.getSnapshotDate() + 1000L) {
     return MoreObjects.firstNonNull(issue.effortInMinutes(), 0L);
   }
   return calculateFromChangelog(issue, debtChangelog, period.getSnapshotDate());
 }
コード例 #4
0
ファイル: TestSubmitRule.java プロジェクト: web1992/gerrit
  @Override
  public List<Record> apply(RevisionResource rsrc, Input input) throws AuthException, OrmException {
    if (input == null) {
      input = new Input();
    }
    if (input.rule != null && !rules.isProjectRulesEnabled()) {
      throw new AuthException("project rules are disabled");
    }
    input.filters = MoreObjects.firstNonNull(input.filters, filters);
    SubmitRuleEvaluator evaluator =
        new SubmitRuleEvaluator(changeDataFactory.create(db.get(), rsrc.getControl()));

    List<SubmitRecord> records =
        evaluator
            .setPatchSet(rsrc.getPatchSet())
            .setLogErrors(false)
            .setSkipSubmitFilters(input.filters == Filters.SKIP)
            .setRule(input.rule)
            .evaluate();
    List<Record> out = Lists.newArrayListWithCapacity(records.size());
    AccountLoader accounts = accountInfoFactory.create(true);
    for (SubmitRecord r : records) {
      out.add(new Record(r, accounts));
    }
    if (!out.isEmpty()) {
      out.get(0).prologReductionCount = evaluator.getReductionsConsumed();
    }
    accounts.fill();
    return out;
  }
コード例 #5
0
  public static void main(String[] args) throws Exception {

    final Map<String, String> argsMap = Main.argsToMap(args);
    int port = MoreObjects.firstNonNull(Ints.tryParse(argsMap.get("port")), DEFAULT_PORT);

    Server server = JettyFactory.createServer(8080);
    JettyFactory.startAndWait(server);
  }
コード例 #6
0
ファイル: Resources.java プロジェクト: hpehl/guava
 /**
  * Returns a {@code URL} pointing to {@code resourceName} if the resource is found using the
  * {@linkplain Thread#getContextClassLoader() context class loader}. In simple environments, the
  * context class loader will find resources from the class path. In environments where different
  * threads can have different class loaders, for example app servers, the context class loader
  * will typically have been set to an appropriate loader for the current thread.
  *
  * <p>In the unusual case where the context class loader is null, the class loader that loaded
  * this class ({@code Resources}) will be used instead.
  *
  * @throws IllegalArgumentException if the resource is not found
  */
 public static URL getResource(String resourceName) {
   ClassLoader loader =
       MoreObjects.firstNonNull(
           Thread.currentThread().getContextClassLoader(), Resources.class.getClassLoader());
   URL url = loader.getResource(resourceName);
   checkArgument(url != null, "resource %s not found.", resourceName);
   return url;
 }
コード例 #7
0
ファイル: Exceptions.java プロジェクト: zouxiaoliang/crate
 public static String messageOf(@Nullable Throwable t) {
   if (t == null) {
     return "Unknown";
   }
   @SuppressWarnings("all") // throwable not thrown
   Throwable unwrappedT = unwrap(t);
   return MoreObjects.firstNonNull(unwrappedT.getMessage(), unwrappedT.toString());
 }
コード例 #8
0
 @Override
 public String getPluginName(Path srcPath) {
   try {
     return MoreObjects.firstNonNull(getJarPluginName(srcPath), PluginLoader.nameOf(srcPath));
   } catch (IOException e) {
     throw new IllegalArgumentException(
         "Invalid plugin file " + srcPath + ": cannot get plugin name", e);
   }
 }
コード例 #9
0
ファイル: TreeMultiset.java プロジェクト: EdwardLee03/guava
 @Nullable
 private AvlNode<E> floor(Comparator<? super E> comparator, E e) {
   int cmp = comparator.compare(e, elem);
   if (cmp > 0) {
     return (right == null) ? this : MoreObjects.firstNonNull(right.floor(comparator, e), this);
   } else if (cmp == 0) {
     return this;
   } else {
     return (left == null) ? null : left.floor(comparator, e);
   }
 }
コード例 #10
0
ファイル: ObjectsDemo.java プロジェクト: xuyuanfa/guava-demo
  public static void main(String[] args) {
    System.out.println(Objects.equal("a", "a")); // returns true
    System.out.println(Objects.equal(null, "a")); // returns false
    System.out.println(Objects.equal("a", null)); // returns false
    System.out.println(Objects.equal(null, null)); // returns true

    System.out.println(Objects.hashCode(1, 2, 3));

    toStringHelper();

    System.out.println(MoreObjects.firstNonNull(null, 1));
  }
コード例 #11
0
 private Injector getPluginInjector(Path jarPath) throws IOException {
   final String pluginName =
       MoreObjects.firstNonNull(
           JarPluginProvider.getJarPluginName(jarPath), PluginLoader.nameOf(jarPath));
   return initInjector.createChildInjector(
       new AbstractModule() {
         @Override
         protected void configure() {
           bind(String.class).annotatedWith(PluginName.class).toInstance(pluginName);
         }
       });
 }
コード例 #12
0
  public String getGitHttpUrl() throws UnknownHostException {
    String httpListenUrl = getHttpListenUrl();
    if (httpListenUrl == null) {
      return "";
    }
    if (!downloadSchemes.isEmpty() && !downloadSchemes.contains("http")) {
      return "";
    }

    String httpUrl = MoreObjects.firstNonNull(canonicalWebUrlString, httpListenUrl);
    httpUrl = httpUrl.replace("://", "://" + GITBLIT_USER + "@");
    httpUrl += (httpUrl.endsWith("/") ? "" : "/") + GITBLIT_REPO;
    return httpUrl;
  }
コード例 #13
0
  /**
   * @param kbServerUrl Kill Bill url
   * @param username Kill Bill username
   * @param password Kill Bill password
   * @param apiKey Kill Bill api key
   * @param apiSecret Kill Bill api secret
   * @param proxyHost hostname of a proxy server that the client should use
   * @param proxyPort port number of a proxy server that the client should use
   * @param connectTimeOut connect timeout in milliseconds
   * @param readTimeOut read timeout in milliseconds
   * @param requestTimeout request timeout in milliseconds
   */
  public KillBillHttpClient(
      final String kbServerUrl,
      final String username,
      final String password,
      final String apiKey,
      final String apiSecret,
      final String proxyHost,
      final Integer proxyPort,
      final Integer connectTimeOut,
      final Integer readTimeOut,
      final Integer requestTimeout) {
    this.kbServerUrl = kbServerUrl;
    this.username = username;
    this.password = password;
    this.apiKey = apiKey;
    this.apiSecret = apiSecret;

    final AsyncHttpClientConfig.Builder cfg = new AsyncHttpClientConfig.Builder();

    cfg.setConnectTimeout(
        MoreObjects.firstNonNull(connectTimeOut, DEFAULT_HTTP_TIMEOUT_SEC * 1000));
    cfg.setReadTimeout(MoreObjects.firstNonNull(readTimeOut, DEFAULT_HTTP_TIMEOUT_SEC * 1000));
    cfg.setRequestTimeout(
        MoreObjects.firstNonNull(requestTimeout, DEFAULT_HTTP_TIMEOUT_SEC * 1000));
    cfg.setUserAgent(USER_AGENT);

    if (proxyHost != null && proxyPort != null) {
      final ProxyServer proxyServer = new ProxyServer(proxyHost, proxyPort);
      cfg.setProxyServer(proxyServer);
    }

    this.httpClient = new AsyncHttpClient(cfg.build());

    mapper = new ObjectMapper();
    mapper.registerModule(new JodaModule());
  }
コード例 #14
0
  /** Registers all subscriber methods on the given listener object. */
  void register(Object listener) {
    Multimap<Class<?>, Subscriber> listenerMethods = findAllSubscribers(listener);

    for (Map.Entry<Class<?>, Collection<Subscriber>> entry : listenerMethods.asMap().entrySet()) {
      Class<?> eventType = entry.getKey();
      Collection<Subscriber> eventMethodsInListener = entry.getValue();

      CopyOnWriteArraySet<Subscriber> eventSubscribers = subscribers.get(eventType);

      if (eventSubscribers == null) {
        CopyOnWriteArraySet<Subscriber> newSet = new CopyOnWriteArraySet<Subscriber>();
        eventSubscribers =
            MoreObjects.firstNonNull(subscribers.putIfAbsent(eventType, newSet), newSet);
      }

      eventSubscribers.addAll(eventMethodsInListener);
    }
  }
コード例 #15
0
  protected ChangeInserter newChange(
      TestRepository<Repo> repo,
      @Nullable RevCommit commit,
      @Nullable String key,
      @Nullable Integer owner,
      @Nullable String branch)
      throws Exception {
    if (commit == null) {
      commit = repo.parseBody(repo.commit().message("message").create());
    }
    Account.Id ownerId = owner != null ? new Account.Id(owner) : userId;
    branch = MoreObjects.firstNonNull(branch, "refs/heads/master");
    if (!branch.startsWith("refs/heads/")) {
      branch = "refs/heads/" + branch;
    }
    Project.NameKey project =
        new Project.NameKey(repo.getRepository().getDescription().getRepositoryName());

    Change.Id id = new Change.Id(db.nextChangeId());
    if (key == null) {
      key =
          "I"
              + Hashing.sha1()
                  .newHasher()
                  .putInt(id.get())
                  .putString(project.get(), UTF_8)
                  .putString(commit.name(), UTF_8)
                  .putInt(ownerId.get())
                  .putString(branch, UTF_8)
                  .hash()
                  .toString();
    }

    Change change =
        new Change(
            new Change.Key(key),
            id,
            ownerId,
            new Branch.NameKey(project, branch),
            TimeUtil.nowTs());
    IdentifiedUser user = userFactory.create(Providers.of(db), ownerId);
    return changeFactory.create(projectControlFactory.controlFor(project, user), change, commit);
  }
コード例 #16
0
ファイル: DocIndexMetaData.java プロジェクト: proofy/crate
  /**
   * extract dataType from given columnProperties
   *
   * @param columnProperties map of String to Object containing column properties
   * @return dataType of the column with columnProperties
   */
  public static DataType getColumnDataType(Map<String, Object> columnProperties) {
    DataType type;
    String typeName = (String) columnProperties.get("type");

    if (typeName == null) {
      if (columnProperties.containsKey("properties")) {
        type = DataTypes.OBJECT;
      } else {
        return DataTypes.NOT_SUPPORTED;
      }
    } else if (typeName.equalsIgnoreCase("array")) {

      Map<String, Object> innerProperties = getNested(columnProperties, "inner");
      DataType innerType = getColumnDataType(innerProperties);
      type = new ArrayType(innerType);
    } else {
      typeName = typeName.toLowerCase(Locale.ENGLISH);
      type = MoreObjects.firstNonNull(dataTypeMap.get(typeName), DataTypes.NOT_SUPPORTED);
    }
    return type;
  }
コード例 #17
0
  public AsmController createControllerInstance(Asm asm, String controllerClassName)
      throws AsmRenderingException {
    Class controllerClass;
    try {
      ClassLoader cl =
          MoreObjects.firstNonNull(
              Thread.currentThread().getContextClassLoader(), asm.getClass().getClassLoader());
      controllerClass = cl.loadClass(controllerClassName);
      if (!AsmController.class.isAssignableFrom(controllerClass)) {
        throw new AsmRenderingException(
            "AsmController: '"
                + controllerClassName
                + "' "
                + "' class does not implement: "
                + AsmController.class.getName()
                + " interface for assembly: "
                + asm.getName());
      }
    } catch (ClassNotFoundException e) {
      throw new AsmRenderingException(
          "AsmController class: '"
              + controllerClassName
              + "' not found for assembly: "
              + asm.getName(),
          e);
    }

    try {
      return (AsmController) injector.getInstance(controllerClass);
    } catch (Exception e) {
      throw new AsmRenderingException(
          "Failed to instantiate controller: '"
              + controllerClassName
              + "' for assembly: "
              + asm.getName(),
          e);
    }
  }
コード例 #18
0
  public boolean filterBasicAuth(
      HttpServletRequest request, HttpServletResponse response, String hdr)
      throws IOException, UnsupportedEncodingException {
    if (!hdr.startsWith(LIT_BASIC)) {
      response.setHeader("WWW-Authenticate", "Basic realm=\"Gerrit Code Review\"");
      response.sendError(SC_UNAUTHORIZED);
      return false;
    }

    final byte[] decoded = new Base64().decode(hdr.substring(LIT_BASIC.length()).getBytes());
    String usernamePassword =
        new String(decoded, MoreObjects.firstNonNull(request.getCharacterEncoding(), "UTF-8"));
    int splitPos = usernamePassword.indexOf(':');
    if (splitPos < 1) {
      response.setHeader("WWW-Authenticate", "Basic realm=\"Gerrit Code Review\"");
      response.sendError(SC_UNAUTHORIZED);
      return false;
    }
    request.setAttribute("gerrit-username", usernamePassword.substring(0, splitPos));
    request.setAttribute("gerrit-password", usernamePassword.substring(splitPos + 1));

    return true;
  }
コード例 #19
0
ファイル: PluginDaemonTest.java プロジェクト: kinglcc/gerrit
  private void buildPluginJar() throws IOException, InterruptedException {
    Properties properties = loadBuckProperties();
    String buck = MoreObjects.firstNonNull(properties.getProperty(BUCKLC), BUCKLC);
    String target;
    if (standalone) {
      target = "//:" + pluginName;
    } else {
      target = pluginSubPath.toString();
    }

    ProcessBuilder processBuilder =
        new ProcessBuilder(buck, "build", target)
            .directory(pluginRoot.toFile())
            .redirectErrorStream(true);
    // otherwise plugin jar creation fails:
    processBuilder.environment().put("NO_BUCKD", "1");

    Path forceJar = pluginSource.resolve("src/main/java/ForceJarIfMissing.java");
    // if exists after cancelled test:
    Files.deleteIfExists(forceJar);

    Files.createFile(forceJar);
    testSite = tempSiteDir.getRoot().toPath();

    // otherwise process often hangs:
    Path log = testSite.resolve("log");
    processBuilder.redirectErrorStream(true);
    processBuilder.redirectOutput(Redirect.appendTo(log.toFile()));

    try {
      processBuilder.start().waitFor();
    } finally {
      Files.delete(forceJar);
      // otherwise jar not made next time if missing again:
      processBuilder.start().waitFor();
    }
  }
コード例 #20
0
  private Predicate<URI> generateUriPredicate(FileInput fileInput) {
    Predicate<URI> moduloPredicate;
    boolean sharedStorage = MoreObjects.firstNonNull(shared, fileInput.sharedStorageDefault());
    if (sharedStorage) {
      moduloPredicate =
          new Predicate<URI>() {
            @Override
            public boolean apply(URI input) {
              int hash = input.hashCode();
              if (hash == Integer.MIN_VALUE) {
                hash = 0; // Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE
              }
              return Math.abs(hash) % numReaders == readerNumber;
            }
          };
    } else {
      moduloPredicate = MATCH_ALL_PREDICATE;
    }

    if (globPredicate != null) {
      return Predicates.and(moduloPredicate, globPredicate);
    }
    return moduloPredicate;
  }
コード例 #21
0
ファイル: MapMaker.java プロジェクト: EdwardLee03/guava
 Equivalence<Object> getKeyEquivalence() {
   return MoreObjects.firstNonNull(keyEquivalence, getKeyStrength().defaultEquivalence());
 }
コード例 #22
0
ファイル: CacheBuilder.java プロジェクト: EdwardLee03/guava
 Equivalence<Object> getValueEquivalence() {
   return MoreObjects.firstNonNull(valueEquivalence, getValueStrength().defaultEquivalence());
 }
コード例 #23
0
ファイル: QueryConstruct.java プロジェクト: jamesmarva/myria
  /**
   * Given an encoding of a plan fragment, i.e., a connected list of operators, instantiate the
   * actual plan fragment. This includes instantiating the operators and connecting them together.
   * The constraint on the plan fragments is that the last operator in the fragment must be the
   * RootOperator. There is a special exception for older plans in which a CollectConsumer will
   * automatically have a SinkRoot appended to it.
   *
   * @param planFragment the encoded plan fragment.
   * @return the actual plan fragment.
   */
  private static RootOperator instantiateFragment(
      final PlanFragmentEncoding planFragment,
      final ConstructArgs args,
      final Map<PlanFragmentEncoding, RootOperator> instantiatedFragments,
      final Map<Integer, PlanFragmentEncoding> opOwnerFragment,
      final Map<Integer, Operator> allOperators) {
    RootOperator instantiatedFragment = instantiatedFragments.get(planFragment);
    if (instantiatedFragment != null) {
      return instantiatedFragment;
    }

    RootOperator fragmentRoot = null;
    Map<Integer, Operator> myOperators = Maps.newHashMap();
    Map<Integer, AbstractConsumerEncoding<?>> nonIterativeConsumers = Maps.newHashMap();
    Set<IDBControllerEncoding> idbs = Sets.newHashSet();
    /* Instantiate all the operators. */
    for (OperatorEncoding<?> encoding : planFragment.operators) {
      if (encoding instanceof IDBControllerEncoding) {
        idbs.add((IDBControllerEncoding) encoding);
      }
      if (encoding instanceof AbstractConsumerEncoding<?>) {
        nonIterativeConsumers.put(encoding.opId, (AbstractConsumerEncoding<?>) encoding);
      }

      Operator op = encoding.construct(args);
      /* helpful for debugging. */
      op.setOpName(
          MoreObjects.firstNonNull(encoding.opName, "Operator" + String.valueOf(encoding.opId)));
      op.setOpId(encoding.opId);
      op.setFragmentId(planFragment.fragmentIndex);
      myOperators.put(encoding.opId, op);
      if (op instanceof RootOperator) {
        if (fragmentRoot != null) {
          throw new MyriaApiException(
              Status.BAD_REQUEST,
              "Multiple "
                  + RootOperator.class.getSimpleName()
                  + " detected in the fragment: "
                  + fragmentRoot.getOpName()
                  + ", and "
                  + encoding.opId);
        }
        fragmentRoot = (RootOperator) op;
      }
    }
    allOperators.putAll(myOperators);

    for (IDBControllerEncoding idb : idbs) {
      nonIterativeConsumers.remove(idb.argIterationInput);
      nonIterativeConsumers.remove(idb.argEosControllerInput);
    }

    Set<PlanFragmentEncoding> dependantFragments = Sets.newHashSet();
    for (AbstractConsumerEncoding<?> c : nonIterativeConsumers.values()) {
      dependantFragments.add(opOwnerFragment.get(c.argOperatorId));
    }

    for (PlanFragmentEncoding f : dependantFragments) {
      instantiateFragment(f, args, instantiatedFragments, opOwnerFragment, allOperators);
    }

    for (AbstractConsumerEncoding<?> c : nonIterativeConsumers.values()) {
      Consumer consumer = (Consumer) myOperators.get(c.opId);
      Integer producingOpName = c.argOperatorId;
      Operator producingOp = allOperators.get(producingOpName);
      if (producingOp instanceof IDBController) {
        consumer.setSchema(IDBController.EOI_REPORT_SCHEMA);
      } else {
        consumer.setSchema(producingOp.getSchema());
      }
    }

    /* Connect all the operators. */
    for (OperatorEncoding<?> encoding : planFragment.operators) {
      encoding.connect(myOperators.get(encoding.opId), myOperators);
    }

    for (IDBControllerEncoding idb : idbs) {
      IDBController idbOp = (IDBController) myOperators.get(idb.opId);
      Consumer eosControllerInput =
          (Consumer) idbOp.getChildren()[IDBController.CHILDREN_IDX_EOS_CONTROLLER_INPUT];
      eosControllerInput.setSchema(EOSController.EOS_REPORT_SCHEMA);
      Operator iterativeInput = idbOp.getChildren()[IDBController.CHILDREN_IDX_ITERATION_INPUT];
      if (iterativeInput instanceof Consumer) {
        Operator initialInput = idbOp.getChildren()[IDBController.CHILDREN_IDX_INITIAL_IDB_INPUT];
        ((Consumer) iterativeInput).setSchema(initialInput.getSchema());
        // Note: better to check if the producer of this iterativeInput also has the same schema,
        // but can't find a good
        // place to add the check given the current framework.
      }
    }

    if (fragmentRoot == null) {
      throw new MyriaApiException(
          Status.BAD_REQUEST,
          "No " + RootOperator.class.getSimpleName() + " detected in the fragment.");
    }

    instantiatedFragments.put(planFragment, fragmentRoot);
    return fragmentRoot;
  }
コード例 #24
0
ファイル: GojaConfig.java プロジェクト: GojaFramework/goja
 public static int getPropertyToInt(String key, int defaultValue) {
   return MoreObjects.firstNonNull(getPropertyToInt(key), defaultValue);
 }
コード例 #25
0
 public BigDecimal getPrice() {
   final BigDecimal price =
       InterfaceWrapperHelper.getValueOverrideOrValue(
           model, I_PMM_PurchaseCandidate.COLUMNNAME_Price);
   return MoreObjects.firstNonNull(price, BigDecimal.ZERO);
 }
コード例 #26
0
 private static String pageTitle(Node doc, MarkdownFile srcFile) {
   String title = MarkdownUtil.getTitle(doc);
   return MoreObjects.firstNonNull(title, srcFile.path);
 }
コード例 #27
0
ファイル: MapMaker.java プロジェクト: EdwardLee03/guava
 Strength getKeyStrength() {
   return MoreObjects.firstNonNull(keyStrength, Strength.STRONG);
 }
コード例 #28
0
ファイル: CacheBuilder.java プロジェクト: EdwardLee03/guava
 // Make a safe contravariant cast now so we don't have to do it over and over.
 @SuppressWarnings("unchecked")
 <K1 extends K, V1 extends V> RemovalListener<K1, V1> getRemovalListener() {
   return (RemovalListener<K1, V1>)
       MoreObjects.firstNonNull(removalListener, NullListener.INSTANCE);
 }
コード例 #29
0
ファイル: MapMaker.java プロジェクト: EdwardLee03/guava
 Strength getValueStrength() {
   return MoreObjects.firstNonNull(valueStrength, Strength.STRONG);
 }
コード例 #30
0
ファイル: CacheBuilder.java プロジェクト: EdwardLee03/guava
 // Make a safe contravariant cast now so we don't have to do it over and over.
 @SuppressWarnings("unchecked")
 <K1 extends K, V1 extends V> Weigher<K1, V1> getWeigher() {
   return (Weigher<K1, V1>) MoreObjects.firstNonNull(weigher, OneWeigher.INSTANCE);
 }