Java 类hudson.model.DescriptorVisibilityFilter 实例源码

项目:docker-plugin    文件:DockerTemplate.java   
/**
 * Get a list of all {@link NodePropertyDescriptor}s we can use to define DockerSlave NodeProperties.
 */
public List<NodePropertyDescriptor> getNodePropertiesDescriptors() {

    // Copy/paste hudson.model.Slave.SlaveDescriptor.nodePropertyDescriptors marked as @Restricted for reasons I don't get
    List<NodePropertyDescriptor> result = new ArrayList<NodePropertyDescriptor>();
    Collection<NodePropertyDescriptor> list =
            (Collection) Jenkins.getInstance().getDescriptorList(NodeProperty.class);
    for (NodePropertyDescriptor npd : DescriptorVisibilityFilter.applyType(DockerTransientNode.class, list)) {
        if (npd.isApplicable(DockerTransientNode.class)) {
            result.add(npd);
        }
    }


    final Iterator<NodePropertyDescriptor> iterator = result.iterator();
    while (iterator.hasNext()) {
        final NodePropertyDescriptor de = iterator.next();
        // see https://issues.jenkins-ci.org/browse/JENKINS-47697
        if ("org.jenkinsci.plugins.matrixauth.AuthorizationMatrixNodeProperty".equals(de.getKlass().toJavaClass().getName())) {
            iterator.remove();
        }
    }
    return result;
}
项目:jenkins-kubernetes-plugin    文件:ContainerTemplate.java   
@SuppressWarnings("unused") // Used by jelly
@Restricted(DoNotUse.class) // Used by jelly
public List<? extends Descriptor> getEnvVarsDescriptors() {
    return DescriptorVisibilityFilter.apply(null, Jenkins.getInstance().getDescriptorList(TemplateEnvVar.class));
}
项目:jenkins-kubernetes-plugin    文件:PodTemplate.java   
@SuppressWarnings("unused") // Used by jelly
@Restricted(DoNotUse.class) // Used by jelly
public List<? extends Descriptor> getEnvVarsDescriptors() {
    return DescriptorVisibilityFilter.apply(null, Jenkins.getInstance().getDescriptorList(TemplateEnvVar.class));
}