hudson.Util.join()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(282)

本文整理了Java中hudson.Util.join()方法的一些代码示例,展示了Util.join()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.join()方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:join

Util.join介绍

[英]Concatenate multiple strings by inserting a separator.
[中]通过插入分隔符连接多个字符串。

代码示例

代码示例来源:origin: jenkinsci/jenkins

public MissingDependencyException(String pluginShortName, List<Dependency> missingDependencies) {
  super("One or more dependencies could not be resolved for " + pluginShortName + " : "
      + Util.join(missingDependencies, ", "));
  this.pluginShortName = pluginShortName;
  this.missingDependencies = missingDependencies;
}

代码示例来源:origin: jenkinsci/jenkins

public CycleDetectedException(List cycle) {
    super("Cycle detected: "+Util.join(cycle," -> "));
    this.cycle = cycle;
  }
}

代码示例来源:origin: jenkinsci/jenkins

public String getDependsOn() {
  if (names==null)    return null;
  if (dependsOn==null)
    dependsOn = join(names," ");
  return dependsOn;
}

代码示例来源:origin: jenkinsci/jenkins

/**
   * Returns the string representation of the classpath.
   */
  @Override
  public String toString() {
    return Util.join(args,File.pathSeparator);
  }
}

代码示例来源:origin: jenkinsci/jenkins

private void cutCycleAt(String referee, List<String> cycle) {
  // cycle contains variables in referrer-to-referee order.
  // This should not be negative, for the first and last one is same.
  int refererIndex = cycle.lastIndexOf(referee) - 1;
  
  assert(refererIndex >= 0);
  String referrer = cycle.get(refererIndex);
  boolean removed = refereeSetMap.get(referrer).remove(referee);
  assert(removed);
  LOGGER.warning(String.format("Cyclic reference detected: %s", Util.join(cycle," -> ")));
  LOGGER.warning(String.format("Cut the reference %s -> %s", referrer, referee));
}

代码示例来源:origin: jenkinsci/jenkins

protected Process sudoWithPass(ArgumentListBuilder args) throws IOException {
    args.prepend(sudoExe(),"-S");
    listener.getLogger().println("$ "+Util.join(args.toList()," "));
    ProcessBuilder pb = new ProcessBuilder(args.toCommandArray());
    Process p = pb.start();
    // TODO: use -p to detect prompt
    // TODO: detect if the password didn't work
    PrintStream ps = new PrintStream(p.getOutputStream());
    ps.println(rootPassword);
    ps.println(rootPassword);
    ps.println(rootPassword);
    return p;
  }
}.start(listener,rootPassword);

代码示例来源:origin: jenkinsci/jenkins

private void interrupt(Result result, boolean forShutdown, CauseOfInterruption... causes) {
  if (LOGGER.isLoggable(FINE))
    LOGGER.log(FINE, String.format("%s is interrupted(%s): %s", getDisplayName(), result, Util.join(Arrays.asList(causes),",")), new InterruptedException());
  lock.writeLock().lock();
  try {
    if (!started) {
      // not yet started, so simply dispose this
      owner.removeExecutor(this);
      return;
    }
    interruptStatus = result;
    for (CauseOfInterruption c : causes) {
      if (!this.causes.contains(c))
        this.causes.add(c);
    }
    if (asynchronousExecution != null) {
      asynchronousExecution.interrupt(forShutdown);
    } else {
      super.interrupt();
    }
  } finally {
    lock.writeLock().unlock();
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Computes the list of other form fields that the given field depends on, via the doFillXyzItems method,
 * and sets that as the 'fillDependsOn' attribute. Also computes the URL of the doFillXyzItems and
 * sets that as the 'fillUrl' attribute.
 */
public void calcFillSettings(String field, Map<String,Object> attributes) {
  String capitalizedFieldName = StringUtils.capitalize(field);
  String methodName = "doFill" + capitalizedFieldName + "Items";
  Method method = ReflectionUtils.getPublicMethodNamed(getClass(), methodName);
  if(method==null)
    throw new IllegalStateException(String.format("%s doesn't have the %s method for filling a drop-down list", getClass(), methodName));
  // build query parameter line by figuring out what should be submitted
  List<String> depends = buildFillDependencies(method, new ArrayList<String>());
  if (!depends.isEmpty())
    attributes.put("fillDependsOn",Util.join(depends," "));
  attributes.put("fillUrl", String.format("%s/%s/fill%sItems", getCurrentDescriptorByNameUrl(), getDescriptorUrl(), capitalizedFieldName));
}

代码示例来源:origin: jenkinsci/jenkins

ClassLoader dependencyLoader = new DependencyClassLoader(coreClassLoader, archive, Util.join(dependencies,optionalDependencies));
dependencyLoader = getBaseClassLoader(atts, dependencyLoader);

代码示例来源:origin: jenkinsci/jenkins

scmNames.add(s.getDescriptor().getDisplayName());
scmDisplayName = " " + Util.join(scmNames, ", ");

代码示例来源:origin: jenkinsci/jenkins

@Override
  public void buildEnvironmentFor(Job j, EnvVars env, TaskListener listener) throws IOException, InterruptedException {
    Jenkins jenkins = Jenkins.getInstance();
    String rootUrl = jenkins.getRootUrl();
    if(rootUrl!=null) {
      env.put("JENKINS_URL", rootUrl);
      env.put("HUDSON_URL", rootUrl); // Legacy compatibility
      env.put("JOB_URL", rootUrl+j.getUrl());
    }

    String root = jenkins.getRootDir().getPath();
    env.put("JENKINS_HOME", root);
    env.put("HUDSON_HOME", root);   // legacy compatibility

    Thread t = Thread.currentThread();
    if (t instanceof Executor) {
      Executor e = (Executor) t;
      env.put("EXECUTOR_NUMBER", String.valueOf(e.getNumber()));
      if (e.getOwner() instanceof MasterComputer) {
        env.put("NODE_NAME", "master");
      } else {
        env.put("NODE_NAME", e.getOwner().getName());
      }
      Node n = e.getOwner().getNode();
      if (n != null)
        env.put("NODE_LABELS", Util.join(n.getAssignedLabels(), " "));
    }
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public String getDependsOn() {
  if (names==null)    return null;
  if (dependsOn==null)
    dependsOn = join(names," ");
  return dependsOn;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
   * Returns the string representation of the classpath.
   */
  @Override
  public String toString() {
    return Util.join(args,File.pathSeparator);
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public MissingDependencyException(String pluginShortName, List<Dependency> missingDependencies) {
  super("One or more dependencies could not be resolved for " + pluginShortName + " : "
      + Util.join(missingDependencies, ", "));
  this.pluginShortName = pluginShortName;
  this.missingDependencies = missingDependencies;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public CycleDetectedException(List cycle) {
    super("Cycle detected: "+Util.join(cycle," -> "));
    this.cycle = cycle;
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public CycleDetectedException(List cycle) {
    super("Cycle detected: " + Util.join(cycle, " -> "));
    this.cycle = cycle;
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
   * @since 2.1.0
   */
  public String toString(final String sep) {
    return Util.join(args,sep);
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private void cutCycleAt(String referee, List<String> cycle) {
  // cycle contains variables in referrer-to-referee order.
  // This should not be negative, for the first and last one is same.
  int refererIndex = cycle.lastIndexOf(referee) - 1;
  
  assert(refererIndex >= 0);
  String referrer = cycle.get(refererIndex);
  boolean removed = refereeSetMap.get(referrer).remove(referee);
  assert(removed);
  LOGGER.warning(String.format("Cyclic reference detected: %s", Util.join(cycle," -> ")));
  LOGGER.warning(String.format("Cut the reference %s -> %s", referrer, referee));
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Gets the {@link Label}s where the builds will be run.
 * @return never null
 */
public Set<Label> getLabels() {
  Set<Label> r = new HashSet<Label>();
  for (Combination c : getAxes().subList(LabelAxis.class).list())
    r.add(Hudson.getInstance().getLabel(Util.join(c.values(),"&&")));
  return r;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

@Override
public Label getAssignedLabel() {
  // combine all the label axes by &&.
  String expr = Util.join(combination.values(getParent().getAxes().subList(LabelAxis.class)), "&&");
  return Hudson.getInstance().getLabel(Util.fixEmpty(expr));
}

相关文章