Java Code Examples for hudson.model.Descriptor#getClass()
The following examples show how to use
hudson.model.Descriptor#getClass() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataBoundConfigurator.java From configuration-as-code-plugin with MIT License | 5 votes |
@NonNull public Class getImplementedAPI() { final Descriptor descriptor = getDescriptor(); if (descriptor != null) { // traverse Descriptor's class hierarchy until we found "extends Descriptor<ExtensionPoint>" Class c = descriptor.getClass(); Type superclass; do { superclass = c.getGenericSuperclass(); c = c.getSuperclass(); } while (c != Descriptor.class); if (superclass instanceof ParameterizedType) { final ParameterizedType genericSuperclass = (ParameterizedType) superclass; Type type = genericSuperclass.getActualTypeArguments()[0]; if (type instanceof ParameterizedType) { type = ((ParameterizedType) type).getRawType(); } if (type instanceof Class) { return (Class) type; } } } return super.getImplementedAPI(); }
Example 2
Source File: DescriptorConfigurator.java From configuration-as-code-plugin with MIT License | 4 votes |
public DescriptorConfigurator(Descriptor descriptor) { this.descriptor = descriptor; this.target = descriptor.getClass(); this.names = resolvePossibleNames(descriptor); }