Skip to content
Browse files

Merge branch 'JENKINS-26781' of into JEN…

  • Loading branch information
jglick committed Apr 14, 2015
2 parents b62a07c + 3c4b1e6 commit 2dcb6d3505d7166a94a6410c3c146a5e4350f8c1
@@ -910,6 +910,9 @@ private URL getStaticHelpUrl(Klass<?> c, String suffix) {
for (Object o : JSONArray.fromObject(formData)) {
JSONObject jo = (JSONObject)o;
Descriptor<T> d = null;
// 'kind' and '$class' are mutually exclusive (see class-entry.jelly), but to be more lenient on the reader side,
// we check them both anyway. 'kind' (which maps to ID) is more unique than '$class', which can have multiple matching
// Descriptors, so we prefer 'kind' if it's present.
String kind = jo.optString("kind", null);
if (kind != null) {
d = findById(descriptors, kind);
@@ -26,6 +26,16 @@ THE SOFTWARE.
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
Invisible &lt;f:entry> type for embedding a descriptor's $class field.

Most of the time a Descriptor has an unique class name that we can use to instantiate the right Describable
class, so we use the '$class' to represent that to clarify the intent.

In some other times, such as templates, there are multiple Descriptors with the same Descriptor.clazz
but different IDs, and in that case we put 'kind' to indicate that. In this case, to avoid confusing
readers we do not put non-unique '$class'.

See Descriptor.newInstancesFromHeteroList for how the reader side is handled.

<st:attribute name="clazz">
The describable class that we are instantiating via structured form submission.
@@ -41,8 +51,7 @@ THE SOFTWARE.
<input type="hidden" name="kind" value="${}" />
<!-- Legacy: Remove once plugins have been staged onto $class -->
<input type="hidden" name="stapler-class" value="${clazz}" />
<input type="hidden" name="stapler-class" value="${clazz}" /> <!-- Legacy: Remove once plugins have been staged onto $class -->
<input type="hidden" name="$class" value="${clazz}" />

0 comments on commit 2dcb6d3

Please sign in to comment.
You can’t perform that action at this time.