提交 a36199f1 编写于 作者: D Daniel Beck

Use default implementation for this interface

上级 53f640fa
......@@ -523,10 +523,6 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
}
}
public Descriptor getDescriptorByName(String className) {
return Jenkins.getInstance().getDescriptorByName(className);
}
/**
* Accepts the new description.
*/
......
......@@ -1624,11 +1624,6 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
}
}
@Override
public Descriptor getDescriptorByName(String className) {
return Jenkins.getInstance().getDescriptorByName(className);
}
/**
* A value class to provide a consistent snapshot view of the state of an executor to avoid race conditions
* during rendering of the executors list.
......
......@@ -23,6 +23,8 @@
*/
package hudson.model;
import jenkins.model.Jenkins;
/**
* Adds {@link #getDescriptorByName(String)} to bind {@link Descriptor}s to URL.
* Binding them at some specific object (instead of {@link jenkins.model.Jenkins}), allows
......@@ -46,5 +48,7 @@ public interface DescriptorByNameOwner extends ModelObject {
* @param id
* Either {@link Descriptor#getId()} (recommended) or the short name.
*/
Descriptor getDescriptorByName(String id);
default Descriptor getDescriptorByName(String id) {
return Jenkins.getInstance().getDescriptorByName(id);
}
}
......@@ -1015,11 +1015,6 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
return id != null ? id : Integer.toString(number);
}
@Override
public @CheckForNull Descriptor getDescriptorByName(String className) {
return Jenkins.getInstance().getDescriptorByName(className);
}
/**
* Get the root directory of this {@link Run} on the master.
* Files related to this {@link Run} should be stored below this directory.
......
......@@ -935,10 +935,6 @@ public class User extends AbstractModelObject implements AccessControlled, Descr
return r;
}
public Descriptor getDescriptorByName(String className) {
return Jenkins.getInstance().getDescriptorByName(className);
}
public Object getDynamic(String token) {
for(Action action: getTransientActions()){
if(Objects.equals(action.getUrlName(), token))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册