Tabnine Logo
ModelASTBranch
Code IndexAdd Tabnine to your IDE (free)

How to use
ModelASTBranch
in
org.jenkinsci.plugins.pipeline.modeldefinition.ast

Best Java code snippets using org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTBranch (Showing top 20 results out of 315)

origin: jenkinsci/pipeline-model-definition-plugin

@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  ModelASTBranch that = (ModelASTBranch) o;
  if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) {
    return false;
  }
  return getSteps() != null ? getSteps().equals(that.getSteps()) : that.getSteps() == null;
}
origin: org.jenkinsci.plugins/pipeline-model-api

@Override
public void removeSourceLocation() {
  super.removeSourceLocation();
  branch.removeSourceLocation();
}
origin: jenkinsci/pipeline-model-definition-plugin

@Override
public String toGroovy() {
  return condition + " {\n" + branch.toGroovy() + "\n}\n";
}
origin: jenkinsci/pipeline-model-definition-plugin

assertNull(firstBranch.getSourceLocation());
assertNotNull(firstBranch);
assertEquals(1, firstBranch.getSteps().size());
ModelASTStep firstStep = firstBranch.getSteps().get(0);
assertNull(firstStep.getSourceLocation());
assertEquals("junit", firstStep.getName());
origin: org.jenkinsci.plugins/pipeline-model-api

  result.append('"' + StringEscapeUtils.escapeJava(branch.getName()) + '"')
      .append(": {\n")
      .append(branch.toGroovy())
      .append("\n}");
result.append(branches.get(0).toGroovy());
origin: jenkinsci/pipeline-model-definition-plugin

private ModelASTBranch branchForName(String name, List<ModelASTBranch> branches) {
  for (ModelASTBranch branch : branches) {
    if (branch.getName().equals(name)) {
      return branch;
    }
  }
  return null;
}
origin: jenkinsci/pipeline-model-definition-plugin

/**
 * Construct the new {@link BlockStatement} for the given branch.
 */
@Nonnull
public final BlockStatement handleBranch(@Nonnull ModelASTBranch branch) {
  BlockStatement newBlock = block();
  for (ModelASTStep s : branch.getSteps()) {
    // Don't process script blocks or a step that for some reason isn't an expression statement at all
    if (s instanceof AbstractModelASTCodeBlock || !(s.getSourceLocation() instanceof ExpressionStatement)) {
      newBlock.addStatement((Statement)s.getSourceLocation());
    } else {
      ExpressionStatement es = (ExpressionStatement) s.getSourceLocation();
      if (es.getExpression() instanceof MethodCallExpression) {
        MethodCallExpression methodCall = (MethodCallExpression) es.getExpression();
        newBlock.addStatement(stmt(handleStep(s, methodCall)));
      } else {
        newBlock.addStatement(es);
      }
    }
  }
  return newBlock;
}
origin: jenkinsci/pipeline-model-definition-plugin

@Override
public void validate(@Nonnull ModelValidator validator) {
  validator.validateElement(this);
  branch.validate(validator);
}
origin: jenkinsci/pipeline-model-definition-plugin

@Override
public JSONObject toJSON() {
  return new JSONObject().accumulate("condition", condition).accumulate("branch", branch.toJSON());
}
origin: jenkinsci/pipeline-model-definition-plugin

  @Override
  public int hashCode() {
    int result = super.hashCode();
    result = 31 * result + (getCondition() != null ? getCondition().hashCode() : 0);
    result = 31 * result + (getBranch() != null ? getBranch().hashCode() : 0);
    return result;
  }
}
origin: jenkinsci/pipeline-model-definition-plugin

@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  ModelASTBuildCondition that = (ModelASTBuildCondition) o;
  if (getCondition() != null ? !getCondition().equals(that.getCondition()) : that.getCondition() != null) {
    return false;
  }
  return getBranch() != null ? getBranch().equals(that.getBranch()) : that.getBranch() == null;
}
origin: jenkinsci/pipeline-model-definition-plugin

assertNull(firstBranch.getSourceLocation());
assertNotNull(firstBranch);
assertEquals(1, firstBranch.getSteps().size());
ModelASTStep firstStep = firstBranch.getSteps().get(0);
assertNull(firstStep.getSourceLocation());
assertEquals("echo", firstStep.getName());
assertNull(secondBranch.getSourceLocation());
assertEquals(2, secondBranch.getSteps().size());
ModelASTStep scriptStep = secondBranch.getSteps().get(0);
assertNull(scriptStep.getSourceLocation());
assertTrue(scriptStep instanceof ModelASTScriptBlock);
assertNull(scriptVal.getSourceLocation());
ModelASTStep timeoutStep = secondBranch.getSteps().get(1);
assertNull(timeoutStep.getSourceLocation());
assertTrue(timeoutStep instanceof ModelASTTreeStep);
origin: jenkinsci/pipeline-model-definition-plugin

  result.append('"' + StringEscapeUtils.escapeJava(branch.getName()) + '"')
      .append(": {\n")
      .append(branch.toGroovy())
      .append("\n}");
result.append(branches.get(0).toGroovy());
origin: jenkinsci/pipeline-model-definition-plugin

newParallelMap.addMapEntryExpression(constX(b.getName()), closureX(handleBranch(b)));
origin: org.jenkinsci.plugins/pipeline-model-api

@Override
public void validate(ModelValidator validator) {
  validator.validateElement(this);
  branch.validate(validator);
}
origin: org.jenkinsci.plugins/pipeline-model-api

@Override
public JSONObject toJSON() {
  return new JSONObject().accumulate("condition", condition).accumulate("branch", branch.toJSON());
}
origin: org.jenkinsci.plugins/pipeline-model-api

  @Override
  public int hashCode() {
    int result = super.hashCode();
    result = 31 * result + (getCondition() != null ? getCondition().hashCode() : 0);
    result = 31 * result + (getBranch() != null ? getBranch().hashCode() : 0);
    return result;
  }
}
origin: org.jenkinsci.plugins/pipeline-model-api

@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  ModelASTBuildCondition that = (ModelASTBuildCondition) o;
  if (getCondition() != null ? !getCondition().equals(that.getCondition()) : that.getCondition() != null) {
    return false;
  }
  return getBranch() != null ? getBranch().equals(that.getBranch()) : that.getBranch() == null;
}
origin: jenkinsci/pipeline-model-definition-plugin

  @Override
  public int hashCode() {
    int result = super.hashCode();
    result = 31 * result + (getName() != null ? getName().hashCode() : 0);
    result = 31 * result + (getSteps() != null ? getSteps().hashCode() : 0);
    return result;
  }
}
origin: org.jenkinsci.plugins/pipeline-model-api

public void validate(final ModelValidator validator, boolean isNested) {
  validator.validateElement(this, isNested);
  for (ModelASTBranch branch : branches) {
    branch.validate(validator);
  }
  if (parallel != null) {
    parallel.validate(validator, true);
  }
  if (agent != null) {
    agent.validate(validator);
  }
  if (when != null) {
    when.validate(validator);
  }
  if (post != null) {
    post.validate(validator);
  }
  if (tools != null) {
    tools.validate(validator);
  }
  if (environment != null) {
    environment.validate(validator);
  }
}
org.jenkinsci.plugins.pipeline.modeldefinition.astModelASTBranch

Javadoc

Represents a branch of Pipeline steps to execute, either as part of a parallel block, or on its own.

Most used methods

  • getName
  • getSteps
  • equals
  • getSourceLocation
  • hashCode
  • removeSourceLocation
  • toGroovy
  • toJSON
  • validate

Popular in Java

  • Reading from database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • getSharedPreferences (Context)
  • setScale (BigDecimal)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • String (java.lang)
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Option (scala)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now