mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-01 19:15:52 +01:00
remove requires value from extension annotation and add new requires annotation instead
This commit is contained in:
@@ -101,6 +101,14 @@ public class ClassSetElement implements DescriptorElement
|
||||
element.appendChild(attr);
|
||||
}
|
||||
|
||||
if (c.requires != null) {
|
||||
for (String requiresEntry : c.requires) {
|
||||
Element requiresElement = doc.createElement("requires");
|
||||
requiresElement.setTextContent(requiresEntry);
|
||||
element.appendChild(requiresElement);
|
||||
}
|
||||
}
|
||||
|
||||
element.appendChild(classEl);
|
||||
root.appendChild(element);
|
||||
}
|
||||
@@ -122,21 +130,24 @@ public class ClassSetElement implements DescriptorElement
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param className
|
||||
* @param className
|
||||
* @param description
|
||||
* @param requires
|
||||
* @param attributes
|
||||
*/
|
||||
public ClassWithAttributes(String className, String description,
|
||||
Map<String, String> attributes)
|
||||
String[] requires, Map<String, String> attributes)
|
||||
{
|
||||
this.className = className;
|
||||
this.description = description;
|
||||
this.requires = requires;
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
//~--- fields -------------------------------------------------------------
|
||||
|
||||
private final String[] requires;
|
||||
|
||||
/** Field description */
|
||||
private final Map<String, String> attributes;
|
||||
|
||||
|
@@ -42,6 +42,7 @@ import org.xml.sax.SAXException;
|
||||
|
||||
import sonia.scm.annotation.ClassSetElement.ClassWithAttributes;
|
||||
import sonia.scm.plugin.PluginAnnotation;
|
||||
import sonia.scm.plugin.Requires;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -247,6 +248,14 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
|
||||
if (isClassOrInterface(e)) {
|
||||
TypeElement type = (TypeElement) e;
|
||||
|
||||
String[] requires = null;
|
||||
Requires requiresAnnotation = type.getAnnotation(Requires.class);
|
||||
|
||||
if (requiresAnnotation != null) {
|
||||
requires = requiresAnnotation.value();
|
||||
}
|
||||
|
||||
String desc = processingEnv.getElementUtils().getDocComment(type);
|
||||
|
||||
if (desc != null) {
|
||||
@@ -255,7 +264,7 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
|
||||
classes.add(
|
||||
new ClassWithAttributes(
|
||||
type.getQualifiedName().toString(), desc, getAttributesFromAnnotation(e, annotation)
|
||||
type.getQualifiedName().toString(), desc, requires, getAttributesFromAnnotation(e, annotation)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user