當前位置: 首頁>>代碼示例>>Java>>正文


Java Describable類代碼示例

本文整理匯總了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);
}
 
開發者ID:jenkinsci,項目名稱:yaml-project-plugin,代碼行數:18,代碼來源:Binder.java

示例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;
}
 
開發者ID:jenkinsci,項目名稱:yaml-project-plugin,代碼行數:24,代碼來源:Binder.java

示例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);
        }
    }
}
 
開發者ID:10000TB,項目名稱:Jenkins-Plugin-Examples,代碼行數:8,代碼來源:CoreStep.java

示例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;
}
 
開發者ID:enil,項目名稱:gitlab-auth-plugin,代碼行數:30,代碼來源:MockFolderBuilder.java

示例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;
}
 
開發者ID:groupon,項目名稱:DotCi,代碼行數:13,代碼來源:DotCiExtensionsHelper.java

示例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);
	}
}
 
開發者ID:conyx,項目名稱:jenkins.py,代碼行數:10,代碼來源:BuildWrapperDescriptorPW.java

示例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);
	}
}
 
開發者ID:conyx,項目名稱:jenkins.py,代碼行數:10,代碼來源:PropertyDescriptorPW.java

示例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);
	}
}
 
開發者ID:conyx,項目名稱:jenkins.py,代碼行數:10,代碼來源:GlobalConfigurationPW.java

示例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);
}
 
開發者ID:i-m-c,項目名稱:jenkins-inheritance-plugin,代碼行數:16,代碼來源:InheritanceGovernor.java

示例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);
}
 
開發者ID:i-m-c,項目名稱:jenkins-inheritance-plugin,代碼行數:31,代碼來源:InheritanceGovernor.java

示例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;
	}
}
 
開發者ID:i-m-c,項目名稱:jenkins-inheritance-plugin,代碼行數:12,代碼來源:InheritanceGovernor.java

示例12: getDescriptorForType

import hudson.model.Describable; //導入依賴的package包/類
@Nonnull
<E extends Describable<E>, T extends Descriptor<E>> T getDescriptorForType(E describable);
 
開發者ID:inFullMobile,項目名稱:restricted-register-plugin,代碼行數:3,代碼來源:IJenkinsDescriptor.java

示例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());
}
 
開發者ID:inFullMobile,項目名稱:restricted-register-plugin,代碼行數:7,代碼來源:JenkinsDescriptorImpl.java

示例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("");
}
 
開發者ID:inFullMobile,項目名稱:restricted-register-plugin,代碼行數:6,代碼來源:MockJenkinsDescriptor.java

示例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


注:本文中的hudson.model.Describable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。