hudson.model.Hudson.getDescriptor()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(244)

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

Hudson.getDescriptor介绍

[英]Gets the Descriptor that corresponds to the given Describable type.

If you have an instance of type and call Describable#getDescriptor(), you'll get the same instance that this method returns.
[中]获取与给定可描述类型对应的描述符。
如果您有一个类型为的实例,并调用Describable#getDescriptor(),那么您将得到此方法返回的相同实例。

代码示例

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

/**
 * Alias for {@link #getDescriptor(String)}.
 */
public Descriptor getDescriptorByName(String id) {
  return getDescriptor(id);
}

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

/**
 * Alias for {@link #getDescriptor(String)}.
 */
public Descriptor getDescriptorByName(String id) {
  return getDescriptor(id);
}

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

/**
 * Alias for {@link #getDescriptor(String)}.
 */
public Descriptor getDescriptorByName(String id) {
  return getDescriptor(id);
}

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

/**
   * Returns the descriptor of {@link SubversionSCM}.
   */
  public SubversionSCM.DescriptorImpl getSubversionSCMDescriptor() {
    if (scmDescriptor == null) {
      scmDescriptor = (SubversionSCM.DescriptorImpl) Hudson.getInstance().getDescriptor(SubversionSCM.class);
    }
    return scmDescriptor;
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public TeamForgeShareDescriptor getDescriptor() {
  return (TeamForgeShareDescriptor)Hudson.getInstance().
    getDescriptor(getClass());
}

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

/**
 * Creates a new job.
 *
 * <p>
 * This version infers the descriptor from the type of the top-level item.
 *
 * @throws IllegalArgumentException
 *      if the project of the given name already exists.
 */
public synchronized <T extends TopLevelItem> T createProject(Class<T> type, String name) throws IOException {
  return type.cast(createProject((TopLevelItemDescriptor) getDescriptor(type), name));
}

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

/**
 * Creates a new job.
 *
 * <p>
 * This version infers the descriptor from the type of the top-level item.
 *
 * @throws IllegalArgumentException
 *      if the project of the given name already exists.
 */
public synchronized <T extends TopLevelItem> T createProject(Class<T> type, String name) throws IOException {
  return type.cast(createProject((TopLevelItemDescriptor) getDescriptor(type), name));
}

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

/**
 * Returns the descriptor of {@link SubversionSCM}.
 */
public SubversionSCM.DescriptorImpl getSubversionSCMDescriptor() {
 if(scmDescriptor == null) {
   scmDescriptor = (SubversionSCM.DescriptorImpl) Hudson.getInstance().getDescriptor(SubversionSCM.class);
 }
 return scmDescriptor;
}

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

@Override
  public Descriptor<ComputerLauncher> getDescriptor() {
    return Hudson.getInstance().getDescriptor(ManagedWindowsServiceLauncher.class);
  }
};

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

/**
 * Static version of the above getDescriptor method.  The above can't 
 * be static because it's inherited.
 */
public static TeamForgeShareDescriptor getTeamForgeShareDescriptor() {
  return (TeamForgeShareDescriptor)Hudson.getInstance().
    getDescriptor(TeamForgeShare.class);
}

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

/**
 * Creates a new job.
 *
 * <p>
 * This version infers the descriptor from the type of the top-level item.
 *
 * @throws IllegalArgumentException if the project of the given name already
 * exists.
 */
public synchronized <T extends TopLevelItem> T createProject(Class<T> type, String name) throws IOException {
  return type.cast(createProject((TopLevelItemDescriptor) getDescriptor(type), name));
}

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

private static void readItem(StaplerRequest req, JSONObject obj, List<SCM> dest) throws FormException {
    String staplerClass = obj.getString("stapler-class");
    Descriptor<SCM> d = (Descriptor<SCM>) Hudson.getInstance().getDescriptor(staplerClass);
    dest.add(d.newInstance(req, obj));
  }
}

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

@SuppressWarnings("unchecked")
public ArrayList<Descriptor<IvyBuilderType>> getBuilderTypeDescriptors() {
  ArrayList<Descriptor<IvyBuilderType>> buildTypeDescriptors = new ArrayList<Descriptor<IvyBuilderType>>();
  buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(AntIvyBuilderType.class));
  if (Hudson.getInstance().getPlugin("nant") != null) {
    buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(NAntIvyBuilderType.class));
  }
  return buildTypeDescriptors;
}

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

/**
 * Tells Hudson that the help file for the field 'fieldName' is defined in
 * the help file for the 'fieldNameToRedirectTo' in the 'owner' class.
 *
 * @since 1.425
 */
protected void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) {
  helpRedirect.put(fieldName,
      Hudson.getInstance().getDescriptor(owner).getHelpFile(fieldNameToRedirectTo));
}

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

private boolean isCreateAccountBasedOnEmail() {
  Hudson hudson = Hudson.getInstance();
  if (hudson == null) {
    return false;
  }
  DescriptorImpl descriptor = (DescriptorImpl) hudson.getDescriptor(GitSCM.class);
  if (descriptor == null) {
    return false;
  }
  return descriptor.isCreateAccountBasedOnEmail();
}

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

/**
 * Returns {@link Descriptor} whose 'clazz' is the same as {@link #getItemType() the item type}.
 */
public Descriptor getItemTypeDescriptor() {
  return Hudson.getInstance().getDescriptor(getItemType());
}

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

/**
 * Returns the list of {@link org.jfrog.hudson.ArtifactoryServer} configured.
 *
 * @return can be empty but never null.
 */
public static List<ArtifactoryServer> getArtifactoryServers() {
  ArtifactoryBuilder.DescriptorImpl descriptor = (ArtifactoryBuilder.DescriptorImpl)
      Hudson.getInstance().getDescriptor(ArtifactoryBuilder.class);
  return descriptor.getArtifactoryServers();
}

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

/**
 * Returns {@link Descriptor} whose 'clazz' is the same as {@link #getItemType() the item type}.
 */
public Descriptor getItemTypeDescriptor() {
  return Hudson.getInstance().getDescriptor(getItemType());
}

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

public Object call() throws Exception {
    Descriptor d = hudson.getDescriptor(type);
    WebClient wc = createWebClient();
    for (String property : listProperties(properties)) {
      String url = d.getHelpFile(property);
      assertNotNull("Help file for the property "+property+" is missing on "+type, url);
      wc.goTo(url); // make sure it successfully loads
    }
    return null;
  }
});

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

/**
 * Since this shares much of the configuration with {@link EC2Computer}, check its help page, too.
 */
@Override
public String getHelpFile(String fieldName) {
  String p = super.getHelpFile(fieldName);
  if (p==null)
    p = Hudson.getInstance().getDescriptor(EC2OndemandSlave.class).getHelpFile(fieldName);
  if (p==null)
    p = Hudson.getInstance().getDescriptor(EC2SpotSlave.class).getHelpFile(fieldName);
  return p;
}

相关文章

Hudson类方法