org.kohsuke.stapler.StaplerRequest.bindParameters()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(116)

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

StaplerRequest.bindParameters介绍

[英]Instantiates a new object by injecting constructor parameters from the form parameters.

The given class must have a constructor annotated with '@stapler-constructor', and must be processed by the maven-stapler-plugin, so that the parameter names of the constructor is available at runtime.

The prefix is used to control the form parameter name. For example, if the prefix is "foo." and if the constructor is define as Foo(String a, String b), then the constructor will be invoked as new Foo(getParameter("foo.a"),getParameter("foo.b")).
[中]通过从表单参数中注入构造函数参数来实例化新对象。
给定的类必须有一个用“@stapper constructor”注释的构造函数,并且必须由maven Stapper插件处理,以便构造函数的参数名在运行时可用。
前缀用于控制表单参数名称。例如,如果前缀是“foo”如果构造函数被定义为Foo(String a, String b),那么构造函数将被调用为new Foo(getParameter("foo.a"),getParameter("foo.b"))

代码示例

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

public SignupInfo(StaplerRequest req) {
  req.bindParameters(this);
}

代码示例来源:origin: org.jenkins-ci.plugins/rake

@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
  installations = req.bindParametersToList(RubyInstallation.class, "rake.")
    .toArray(new RubyInstallation[0]);
  rvm = req.bindParameters(Rvm.class, "rvm.");
  installations = getGlobalRubies(rvm, installations);
  save();
  return true;
}

代码示例来源:origin: org.jvnet.hudson.plugins/perforce

@Override
  public P4Web newInstance(StaplerRequest req, JSONObject formData) throws FormException {
    return req.bindParameters(P4Web.class,"p4web.");
  }
}

代码示例来源:origin: jenkinsci/jira-plugin

@Override
public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData)
    throws FormException {
  JiraProjectProperty jpp = req.bindParameters(JiraProjectProperty.class, "jira.");
  if (jpp.siteName == null) {
    jpp = null; // not configured
  }
  return jpp;
}

代码示例来源:origin: org.jvnet.hudson.plugins/git

@Override
  public GitWeb newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
    return req.bindParameters(GitWeb.class, "gitweb.");
  }
}

代码示例来源:origin: org.jvnet.hudson.plugins/git

@Override
  public RedmineWeb newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
    return req.bindParameters(RedmineWeb.class, "redmineweb.");
  }
}

代码示例来源:origin: org.jvnet.hudson.plugins/jira

@Override
public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData)
    throws FormException {
  JiraProjectProperty jpp = req.bindParameters(
      JiraProjectProperty.class, "jira.");
  if (jpp.siteName == null)
    jpp = null; // not configured
  return jpp;
}

代码示例来源:origin: org.hudsonci.plugins/mercurial

public @Override FishEye newInstance(StaplerRequest req, JSONObject json) throws FormException {
    return req.bindParameters(FishEye.class,"fisheye.");
  }
}

代码示例来源:origin: org.jvnet.hudson.plugins/perforce

@Override
public FishEyePerforce newInstance(StaplerRequest req, JSONObject formData) throws FormException {
  return req.bindParameters(FishEyePerforce.class, "fisheye.perforce.");
}

代码示例来源:origin: jenkinsci/artifactory-plugin

@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
  req.bindParameters(this, "ivy");
  save();
  return true;
}

代码示例来源:origin: jenkinsci/artifactory-plugin

@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
  req.bindParameters(this, "generic");
  save();
  return true;
}

代码示例来源:origin: jenkinsci/performance-plugin

private String getPerformanceReportNameFile(StaplerRequest request) {
  PerformanceReportPosition performanceReportPosition = new PerformanceReportPosition();
  request.bindParameters(performanceReportPosition);
  return getPerformanceReportNameFile(performanceReportPosition);
}

代码示例来源:origin: jenkinsci/performance-plugin

private String getTestSuiteReportFilename(final StaplerRequest request) {
  PerformanceReportPosition performanceReportPosition = new PerformanceReportPosition();
  request.bindParameters(performanceReportPosition);
  return performanceReportPosition.getPerformanceReportPosition();
}

代码示例来源:origin: jenkinsci/performance-plugin

private String getTrendReportFilename(final StaplerRequest request) {
    PerformanceReportPosition performanceReportPosition = new PerformanceReportPosition();
    request.bindParameters(performanceReportPosition);
    return performanceReportPosition.getPerformanceReportPosition();
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/cloverphp

@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
  req.bindParameters(this, "clover.");
  save();
  return super.configure(req, formData);
}

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

public MavenReporter newInstance(StaplerRequest req, JSONObject formData) throws FormException {
    MavenMailer m = new MavenMailer();
    req.bindParameters(m,"mailer_");
    m.dontNotifyEveryUnstableBuild = req.getParameter("mailer_notifyEveryUnstableBuild")==null;
    return m;
  }
}

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

@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) {
  Mailer m = new Mailer();
  req.bindParameters(m,"mailer_");
  m.dontNotifyEveryUnstableBuild = req.getParameter("mailer_notifyEveryUnstableBuild")==null;
  if(hudsonUrl==null) {
    // if Hudson URL is not configured yet, infer some default
    hudsonUrl = Functions.inferHudsonURL(req);
    save();
  }
  return m;
}

代码示例来源:origin: hudson/hudson-2.x

@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) {
  Mailer m = new Mailer();
  req.bindParameters(m,"mailer_");
  m.dontNotifyEveryUnstableBuild = req.getParameter("mailer_notifyEveryUnstableBuild")==null;
  if(hudsonUrl==null) {
    // if Hudson URL is not configured yet, infer some default
    hudsonUrl = Functions.inferHudsonURL(req);
    save();
  }
  return m;
}

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

@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) {
  Mailer m = new Mailer();
  req.bindParameters(m,"mailer_");
  m.dontNotifyEveryUnstableBuild = req.getParameter("mailer_notifyEveryUnstableBuild")==null;
  if(hudsonUrl==null) {
    // if Hudson URL is not configured yet, infer some default
    hudsonUrl = Functions.inferHudsonURL(req);
    save();
  }
  return m;
}

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

@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) {
  Mailer m = new Mailer();
  req.bindParameters(m, "mailer_");
  m.dontNotifyEveryUnstableBuild = req.getParameter("mailer_notifyEveryUnstableBuild") == null;
  if (hudsonUrl == null) {
    // if Hudson URL is not configured yet, infer some default
    hudsonUrl = Functions.inferHudsonURL(req);
    save();
  }
  return m;
}

相关文章

微信公众号

最新文章

更多

StaplerRequest类方法