Package com.google.common.base

Examples of com.google.common.base.Joiner


     *                   of the quorum
     */
    @Override
    protected Result check() throws Exception {
        final List<ZooKeeperHealthCheck> unhealthy = getUnhealthy();
        final Joiner joiner = Joiner.on(", ");

        if (unhealthy.isEmpty()) {
            return Result.healthy();
        } else if (unhealthy.size() < healthChecks.size()) {
            return Result.unhealthy(String.format(
                    "Some nodes are unhealthy: %s", joiner.join(unhealthy)));
        } else {
            return Result.unhealthy(String.format(
                    "All nodes are unhealthy: %s", joiner.join(unhealthy)));
        }
    }
View Full Code Here


        }

        if (!resourceConfigs.isEmpty()) {
            command.add("-c");

            Joiner joiner = Joiner.on(',');
            command.add(joiner.join(resourceConfigs));
        }

        if (symbolOutputDir != null &&
                (type == VariantConfiguration.Type.LIBRARY || !libraries.isEmpty())) {
            command.add("--output-text-symbols");
View Full Code Here

    @Override
    public HttpResponse executeDirect(HttpRequest request) {

        HttpUriRequest httpUriRequest = null;

        Joiner joiner = Joiner.on(",").skipNulls();
        URI requestUri = buildUri(request, joiner);

        httpUriRequest = buildHttpUriRequest(request, joiner, requestUri);

        try {
View Full Code Here

//            }
//        });

        HttpUriRequest httpUriRequest = null;

        Joiner joiner = Joiner.on(",").skipNulls();
        URI requestUri = buildUri(request, joiner);

        httpUriRequest = buildHttpUriRequest(request, joiner, requestUri);

View Full Code Here

        "Resource request can not be null.");
    Set<String> dedupedRacks = new HashSet<String>();
    if (req.getRacks() != null) {
      dedupedRacks.addAll(req.getRacks());
      if(req.getRacks().size() != dedupedRacks.size()) {
        Joiner joiner = Joiner.on(',');
        LOG.warn("ContainerRequest has duplicate racks: "
            + joiner.join(req.getRacks()));
      }
    }
    Set<String> inferredRacks = resolveRacks(req.getNodes());
    inferredRacks.removeAll(dedupedRacks);

    // check that specific and non-specific requests cannot be mixed within a
    // priority
    checkLocalityRelaxationConflict(req.getPriority(), ANY_LIST,
        req.getRelaxLocality());
    // check that specific rack cannot be mixed with specific node within a
    // priority. If node and its rack are both specified then they must be
    // in the same request.
    // For explicitly requested racks, we set locality relaxation to true
    checkLocalityRelaxationConflict(req.getPriority(), dedupedRacks, true);
    checkLocalityRelaxationConflict(req.getPriority(), inferredRacks,
        req.getRelaxLocality());

    if (req.getNodes() != null) {
      HashSet<String> dedupedNodes = new HashSet<String>(req.getNodes());
      if(dedupedNodes.size() != req.getNodes().size()) {
        Joiner joiner = Joiner.on(',');
        LOG.warn("ContainerRequest has duplicate nodes: "
            + joiner.join(req.getNodes()));       
      }
      for (String node : dedupedNodes) {
        addResourceRequest(req.getPriority(), node, req.getCapability(), req,
            true);
      }
View Full Code Here

        }

        if (!resourceConfigs.isEmpty()) {
            command.add("-c");

            Joiner joiner = Joiner.on(',');
            command.add(joiner.join(resourceConfigs));
        }

        if (symbolOutputDir != null &&
                (type == VariantConfiguration.Type.LIBRARY || !libraries.isEmpty())) {
            command.add("--output-text-symbols");
View Full Code Here

  public static Map<Unit<?>, String> verboseNamesPlur = Maps.newHashMap();

  private static Set<String> dontUse = Sets.newHashSet("in");

  private static void addParsers(final Set<UnitParser> ret, final Class<? extends SystemOfUnits> cls) {
    final Joiner joiner = Joiner.on(' ');
    for (final Field f : cls.getDeclaredFields()) {
      if (!Modifier.isStatic(f.getModifiers())) {
        continue;
      }
      final Class<?> fieldType = f.getType();
      if (Unit.class.isAssignableFrom(fieldType)) {
        final Object[] longName = f.getName().toLowerCase().split("_");
        // Don't do this if its a single word of less than 3 characters,
        // it's too easily misinterpreted
        if (longName.length == 1 && longName[0].toString().length() < 3) {
          continue;
        }
        try {
          final Unit<?> unit = (Unit<?>) f.get(null);
          if (longName.length > 0) {
            ret.add(new UnitParser(unit, TokenList.create(Lists.newArrayList(longName))));
            verboseNamesSing.put(unit, joiner.join(longName));
            // And pluralize
            if (longName[0].toString().charAt(longName[0].toString().length() - 1) != 's') {
              final ArrayList<Object> pluralLongName = Lists.<Object> newArrayList(longName);
              pluralLongName.set(0, pluralLongName.get(0) + "s");
              ret.add(new UnitParser(unit, TokenList.create(pluralLongName)));
              verboseNamesPlur.put(unit, joiner.join(pluralLongName));
            }
          }
          final TokenList shortName = Tokenizer.tokenize(unit.toString());
          // Don't use it if it is only one character, or if its in a
          // list of confusing values like "in"
View Full Code Here

   private void setAvailableVirtualDatacenters(final List<Integer> ids) {
      if (ids == null || ids.size() == 0) {
         target.setAvailableVirtualDatacenters("");
      } else {
         Joiner joiner = Joiner.on(",").skipNulls();
         target.setAvailableVirtualDatacenters(joiner.join(ids));
      }
   }
View Full Code Here

      buf.append(' ').append(attr.getKey()).append("=\"")
         .append(attr.getValue()).append('\"');
    }
    buf.append(">\n");

    Joiner j = Joiner.on("\n");

    j.appendTo(buf, preloads);
    j.appendTo(buf, features.values());
    j.appendTo(buf, icons);
    j.appendTo(buf, locales.values());
    j.appendTo(buf, links.values());

    if (oauth != null) {
      buf.append(oauth).append('\n');
    }
View Full Code Here

          }
        }, tableOf(strings(), pairs(ints(), ints())));
    Iterable<String> lines = SecondarySort.sortAndApply(in, new MapFn<Pair<String, Iterable<Pair<Integer, Integer>>>, String>() {
      @Override
      public String map(Pair<String, Iterable<Pair<Integer, Integer>>> input) {
        Joiner j = Joiner.on(',');
        return j.join(input.first(), j.join(input.second()));
      }
    }, strings()).materialize();
    assertEquals(ImmutableList.of("one,[-5,10],[1,1],[2,-3]", "three,[0,-1]", "two,[1,7],[2,6],[4,5]"),
        ImmutableList.copyOf(lines));
    p.done();
View Full Code Here

TOP

Related Classes of com.google.common.base.Joiner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.