本文整理匯總了Java中hudson.model.Describable類的典型用法代碼示例。如果您正苦於以下問題:Java Describable類的具體用法?Java Describable怎麽用?Java Describable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Describable類屬於hudson.model包,在下文中一共展示了Describable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: bind
import hudson.model.Describable; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
public <T extends Describable> T bind(JSONObject json)
throws IOException, FormException {
final String clazz = checkNotNull(json.optString("$class", null));
final Descriptor descriptor = getDescriptor(clazz);
final Stapler stapler = getStapler();
final StaplerRequest request = getRequest(stapler, json);
// We do this instead of 'request.bindJson' because this doesn't
// require a DataBoundConstructor.
// TODO(mattmoor): Should we do the rewrite of describable lists
// here as well?
return (T) descriptor.newInstance(request, json);
}
示例2: getDescriptor
import hudson.model.Describable; //導入依賴的package包/類
/**
* Gets the {@link Descriptor} of the {@link Describable} we are
* looking to instantiate.
*/
@VisibleForTesting
Descriptor getDescriptor(String clazzName) throws IOException {
Class<? extends Describable<?>> implClass;
try {
implClass = (Class<? extends Describable<?>>) getClassLoader()
.loadClass(clazzName);
} catch (ClassNotFoundException ex) {
throw new BadTypeException(
Messages.DefaultBinder_CannotLoadClass(clazzName));
}
final Descriptor descriptor =
checkNotNull(Jenkins.getInstance()).getDescriptor(implClass);
if (descriptor == null) {
throw new BadTypeException(
Messages.DefaultBinder_NoDescriptor(implClass.getName()));
}
return descriptor;
}
示例3: populate
import hudson.model.Describable; //導入依賴的package包/類
private <T extends Describable<T>,D extends Descriptor<T>> void populate(List<Descriptor<?>> r, Class<T> c) {
for (Descriptor<?> d : Jenkins.getActiveInstance().getDescriptorList(c)) {
if (SimpleBuildStep.class.isAssignableFrom(d.clazz)) {
r.add(d);
}
}
}
示例4: createMockItem
import hudson.model.Describable; //導入依賴的package包/類
@Override
protected final Folder createMockItem() throws Exception {
// mock the common item methods
Folder folder = super.createMockItem();
// mock the property list
DescribableList propertyList = createMock(DescribableList.class);
expect(folder.getProperties()).andReturn(propertyList).anyTimes();
// mock adding properties
folder.addProperty(anyObject(FolderProperty.class));
expectLastCall().andAnswer(new IAnswer<Void>() {
public Void answer() throws Throwable {
addProperty((FolderProperty)getCurrentArguments()[0]);
return null;
}
}).anyTimes();
// mock getting properties
expect(propertyList.get(anyObject(Class.class))).andAnswer(new IAnswer<Describable>() {
public Describable answer() throws Throwable {
return getProperty((Class)getCurrentArguments()[0]);
}
}).anyTimes();
replay(propertyList);
return folder;
}
示例5: getClassList
import hudson.model.Describable; //導入依賴的package包/類
private <T extends Describable<T>, D extends Descriptor<T>> List<Descriptor<?>> getClassList(Class<T> c) {
ArrayList<Descriptor<?>> r = new ArrayList<Descriptor<?>>();
if (jenkins == null) {
return new ArrayList<Descriptor<?>>();
}
for (Descriptor<?> d : jenkins.getDescriptorList(c)) {
if (SimpleBuildStep.class.isAssignableFrom(d.clazz)) {
r.add(d);
}
}
return r;
}
示例6: addHelpFileRedirect
import hudson.model.Describable; //導入依賴的package包/類
@Override
public void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) {
initPython();
if (pexec.isImplemented(16)) {
pexec.execPythonVoid("add_help_file_redirect", fieldName, owner, fieldNameToRedirectTo);
} else {
super.addHelpFileRedirect(fieldName, owner, fieldNameToRedirectTo);
}
}
示例7: addHelpFileRedirect
import hudson.model.Describable; //導入依賴的package包/類
@Override
public void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) {
initPython();
if (pexec.isImplemented(17)) {
pexec.execPythonVoid("add_help_file_redirect", fieldName, owner, fieldNameToRedirectTo);
} else {
super.addHelpFileRedirect(fieldName, owner, fieldNameToRedirectTo);
}
}
示例8: addHelpFileRedirect
import hudson.model.Describable; //導入依賴的package包/類
@Override
public void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) {
initPython();
if (pexec.isImplemented(19)) {
pexec.execPythonVoid("add_help_file_redirect", fieldName, owner, fieldNameToRedirectTo);
} else {
super.addHelpFileRedirect(fieldName, owner, fieldNameToRedirectTo);
}
}
示例9: reduceDescribableByMerge
import hudson.model.Describable; //導入依賴的package包/類
protected static <R extends Describable<R>> DescribableList<R, Descriptor<R>> reduceDescribableByMerge(
Deque<DescribableList<R, Descriptor<R>>> list) {
if (list == null) {
return new DescribableList<R, Descriptor<R>>(NOOP);
}
List<R> merge = new LinkedList<R>();
for (DescribableList<R, Descriptor<R>> sub : list) {
for (R item : sub) {
merge.add(item);
}
}
return new DescribableList<R, Descriptor<R>>(NOOP, merge);
}
示例10: reduceDescribableByMergeWithoutDuplicates
import hudson.model.Describable; //導入依賴的package包/類
protected static <R extends Describable<R>> DescribableList<R, Descriptor<R>> reduceDescribableByMergeWithoutDuplicates(
Deque<DescribableList<R, Descriptor<R>>> list) {
// set for keeping track of found classes
Set<Class<?>> seen = new HashSet<Class<?>>();
if (list == null) {
return new DescribableList<R, Descriptor<R>>(NOOP);
}
// result list
List<R> merge = new LinkedList<R>();
// descending order for keeping the last buildwrapper that was set = lower in the inheritance tree
Iterator<DescribableList<R, Descriptor<R>>> rIter = list.descendingIterator();
while (rIter.hasNext()) {
DescribableList<R, Descriptor<R>> sub = rIter.next();
for (R item : sub) {
Class<?> clazz = item.getClass();
if (!seen.contains(clazz)) {
merge.add(item);
seen.add(clazz);
}
}
}
return new DescribableList<R, Descriptor<R>>(NOOP, merge);
}
示例11: castToDescribableList
import hudson.model.Describable; //導入依賴的package包/類
@SuppressWarnings("unchecked")
protected static <R extends Describable<R>> DescribableList<R, Descriptor<R>> castToDescribableList(Object o) {
try {
if (o instanceof DescribableList) {
return ((DescribableList<R, Descriptor<R>>) o);
}
return null;
} catch (ClassCastException ex) {
return null;
}
}
示例12: getDescriptorForType
import hudson.model.Describable; //導入依賴的package包/類
@Nonnull
<E extends Describable<E>, T extends Descriptor<E>> T getDescriptorForType(E describable);
示例13: getDescriptorForType
import hudson.model.Describable; //導入依賴的package包/類
@Nonnull
@Override
public <E extends Describable<E>, T extends Descriptor<E>> T getDescriptorForType(E describable) {
//noinspection unchecked
return (T) getJenkinsInstanceOrDie().getDescriptor(describable.getClass());
}
示例14: getDescriptorForType
import hudson.model.Describable; //導入依賴的package包/類
@Nonnull
@Override
public <E extends Describable<E>, T extends Descriptor<E>> T getDescriptorForType(E describable) {
throw new UnsupportedOperationException("");
}
示例15: defaultName
import hudson.model.Describable; //導入依賴的package包/類
protected static String defaultName(BuildStep bs) {
return bs instanceof Describable<?> ? ((Describable<?>) bs).getDescriptor().getDisplayName()
: null;
}
開發者ID:GoogleCloudPlatform,項目名稱:jenkins-deployment-manager-plugin,代碼行數:5,代碼來源:BuildStepDetailsProvider.java