Merge pull request #105 from jenkinsci/fix-documentation
Try to fix documentation in #98
This commit is contained in:
commit
c5461bc15a
|
|
@ -48,7 +48,10 @@ public class Attribute<T> {
|
|||
return type;
|
||||
}
|
||||
|
||||
/** Attribute acutaly is a Collection of documented type */
|
||||
/**
|
||||
* Attribute is actually a Collection of documented type
|
||||
* @return boolean indicating if this attribute is a list of multiple items of documented type
|
||||
*/
|
||||
public boolean isMultiple() {
|
||||
return multiple;
|
||||
}
|
||||
|
|
@ -72,7 +75,11 @@ public class Attribute<T> {
|
|||
return setter;
|
||||
}
|
||||
|
||||
/** If this attribute is constrained to a limited set of value, here they are */
|
||||
/**
|
||||
* If this attribute is constrained to a limited set of value, here they are
|
||||
*
|
||||
* @return A list of possible types
|
||||
*/
|
||||
public List<String> possibleValues() {
|
||||
if (type.isEnum()) {
|
||||
Class<Enum> e = (Class<Enum>) type;
|
||||
|
|
@ -96,6 +103,7 @@ public class Attribute<T> {
|
|||
|
||||
/**
|
||||
* Default Setter implementation based on JavaBean property write method.
|
||||
*
|
||||
*/
|
||||
private static final Setter DEFAULT_SETTER = (target, attribute, value) -> {
|
||||
final String setterId = target.getClass().getCanonicalName()+'#'+attribute.name;
|
||||
|
|
|
|||
|
|
@ -78,15 +78,18 @@ public abstract class Configurator<T> implements ExtensionPoint {
|
|||
}
|
||||
|
||||
if (Collection.class.isAssignableFrom(clazz)) {
|
||||
ParameterizedType pt = (ParameterizedType) type;
|
||||
Type actualType = pt.getActualTypeArguments()[0];
|
||||
if (actualType instanceof WildcardType) {
|
||||
actualType = ((WildcardType) actualType).getUpperBounds()[0];
|
||||
//TODO: Only try to cast if we can actually get the parameterized type
|
||||
if (type instanceof ParameterizedType) {
|
||||
ParameterizedType pt = (ParameterizedType) type;
|
||||
Type actualType = pt.getActualTypeArguments()[0];
|
||||
if (actualType instanceof WildcardType) {
|
||||
actualType = ((WildcardType) actualType).getUpperBounds()[0];
|
||||
}
|
||||
if (!(actualType instanceof Class)) {
|
||||
throw new IllegalStateException("Can't handle " + type);
|
||||
}
|
||||
return lookup(actualType);
|
||||
}
|
||||
if (!(actualType instanceof Class)) {
|
||||
throw new IllegalStateException("Can't handle "+type);
|
||||
}
|
||||
return lookup(actualType);
|
||||
}
|
||||
|
||||
if (Descriptor.class.isAssignableFrom(clazz)) {
|
||||
|
|
@ -178,11 +181,15 @@ public abstract class Configurator<T> implements ExtensionPoint {
|
|||
|
||||
/**
|
||||
* The actual component being managed by this Configurator
|
||||
*
|
||||
* @return the actual class that this configurator is configuring
|
||||
*/
|
||||
public abstract Class<T> getTarget();
|
||||
|
||||
/**
|
||||
* The extension point being implemented by this configurator.
|
||||
*
|
||||
* @return The
|
||||
*/
|
||||
public Class getExtensionPoint() {
|
||||
Class t = getTarget();
|
||||
|
|
@ -193,6 +200,8 @@ public abstract class Configurator<T> implements ExtensionPoint {
|
|||
|
||||
/**
|
||||
* Retrieve which plugin do provide this extension point
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String getExtensionSource() throws IOException {
|
||||
final Class e = getExtensionPoint();
|
||||
|
|
@ -205,6 +214,8 @@ public abstract class Configurator<T> implements ExtensionPoint {
|
|||
|
||||
/**
|
||||
* Human friendly display name for this component.
|
||||
*
|
||||
* @return An empty string
|
||||
*/
|
||||
public String getDisplayName() { return ""; }
|
||||
|
||||
|
|
@ -225,6 +236,9 @@ public abstract class Configurator<T> implements ExtensionPoint {
|
|||
|
||||
/**
|
||||
* Ordered version of {@link #describe()} for documentation generation
|
||||
*
|
||||
* @return
|
||||
* A list of {@Link Attribute}s
|
||||
*/
|
||||
public List<Attribute> getAttributes() {
|
||||
final ArrayList<Attribute> attributes = new ArrayList<>(describe());
|
||||
|
|
@ -245,12 +259,15 @@ public abstract class Configurator<T> implements ExtensionPoint {
|
|||
|
||||
/**
|
||||
* Determine the list of Attribute available for configuration of the managed component.
|
||||
*
|
||||
* @return A set of {@Link Attribute}s that describes this object
|
||||
*/
|
||||
public abstract Set<Attribute> describe();
|
||||
|
||||
/**
|
||||
* Retrieve the html help tip associated to an attribute.
|
||||
* FIXME would prefer <st:include page="help-${a.name}.html" class="${c.target}" optional="true"/>
|
||||
* @return String that shows help
|
||||
*/
|
||||
public String getHtmlHelp(String attribute) throws IOException {
|
||||
final URL resource = getKlass().getResource("help-" + attribute + ".html");
|
||||
|
|
|
|||
Loading…
Reference in New Issue