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

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

本文整理了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

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

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

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

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

  1. public String getDependsOn() {
  2. if (names==null) return null;
  3. if (dependsOn==null)
  4. dependsOn = join(names," ");
  5. return dependsOn;
  6. }

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

  1. /**
  2. * Returns the string representation of the classpath.
  3. */
  4. @Override
  5. public String toString() {
  6. return Util.join(args,File.pathSeparator);
  7. }
  8. }

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

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

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

  1. protected Process sudoWithPass(ArgumentListBuilder args) throws IOException {
  2. args.prepend(sudoExe(),"-S");
  3. listener.getLogger().println("$ "+Util.join(args.toList()," "));
  4. ProcessBuilder pb = new ProcessBuilder(args.toCommandArray());
  5. Process p = pb.start();
  6. // TODO: use -p to detect prompt
  7. // TODO: detect if the password didn't work
  8. PrintStream ps = new PrintStream(p.getOutputStream());
  9. ps.println(rootPassword);
  10. ps.println(rootPassword);
  11. ps.println(rootPassword);
  12. return p;
  13. }
  14. }.start(listener,rootPassword);

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

  1. private void interrupt(Result result, boolean forShutdown, CauseOfInterruption... causes) {
  2. if (LOGGER.isLoggable(FINE))
  3. LOGGER.log(FINE, String.format("%s is interrupted(%s): %s", getDisplayName(), result, Util.join(Arrays.asList(causes),",")), new InterruptedException());
  4. lock.writeLock().lock();
  5. try {
  6. if (!started) {
  7. // not yet started, so simply dispose this
  8. owner.removeExecutor(this);
  9. return;
  10. }
  11. interruptStatus = result;
  12. for (CauseOfInterruption c : causes) {
  13. if (!this.causes.contains(c))
  14. this.causes.add(c);
  15. }
  16. if (asynchronousExecution != null) {
  17. asynchronousExecution.interrupt(forShutdown);
  18. } else {
  19. super.interrupt();
  20. }
  21. } finally {
  22. lock.writeLock().unlock();
  23. }
  24. }

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

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

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

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

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

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

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

  1. @Override
  2. public void buildEnvironmentFor(Job j, EnvVars env, TaskListener listener) throws IOException, InterruptedException {
  3. Jenkins jenkins = Jenkins.getInstance();
  4. String rootUrl = jenkins.getRootUrl();
  5. if(rootUrl!=null) {
  6. env.put("JENKINS_URL", rootUrl);
  7. env.put("HUDSON_URL", rootUrl); // Legacy compatibility
  8. env.put("JOB_URL", rootUrl+j.getUrl());
  9. }
  10. String root = jenkins.getRootDir().getPath();
  11. env.put("JENKINS_HOME", root);
  12. env.put("HUDSON_HOME", root); // legacy compatibility
  13. Thread t = Thread.currentThread();
  14. if (t instanceof Executor) {
  15. Executor e = (Executor) t;
  16. env.put("EXECUTOR_NUMBER", String.valueOf(e.getNumber()));
  17. if (e.getOwner() instanceof MasterComputer) {
  18. env.put("NODE_NAME", "master");
  19. } else {
  20. env.put("NODE_NAME", e.getOwner().getName());
  21. }
  22. Node n = e.getOwner().getNode();
  23. if (n != null)
  24. env.put("NODE_LABELS", Util.join(n.getAssignedLabels(), " "));
  25. }
  26. }
  27. }

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

  1. public String getDependsOn() {
  2. if (names==null) return null;
  3. if (dependsOn==null)
  4. dependsOn = join(names," ");
  5. return dependsOn;
  6. }

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

  1. /**
  2. * Returns the string representation of the classpath.
  3. */
  4. @Override
  5. public String toString() {
  6. return Util.join(args,File.pathSeparator);
  7. }
  8. }

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

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

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

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

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

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

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

  1. /**
  2. * @since 2.1.0
  3. */
  4. public String toString(final String sep) {
  5. return Util.join(args,sep);
  6. }
  7. }

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

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

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

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

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

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

相关文章