Author: nickarls
Date: 2009-03-16 04:12:30 -0400 (Mon, 16 Mar 2009)
New Revision: 2027
Modified:
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/FieldModel.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/MethodModel.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/NamedModel.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/ParameterModel.java
Log:
simle meta-annotation model
Modified:
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java
===================================================================
---
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java 2009-03-16
07:16:55 UTC (rev 2026)
+++
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java 2009-03-16
08:12:30 UTC (rev 2027)
@@ -17,8 +17,10 @@
package org.jboss.webbeans.xsd.helpers;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
@@ -61,7 +63,7 @@
*/
public static void populateClassModel(ClassModel classModel, Element element,
ClassModel parent)
{
- List<String> annotations = getAnnotations(element);
+ Map<String, Set<String>> annotations = getAnnotations(element);
TypeElement typeElement = (TypeElement) element;
classModel.setName(typeElement.getQualifiedName().toString());
classModel.setParent(parent);
@@ -82,7 +84,7 @@
}
String name = element.getSimpleName().toString();
String type = element.asType().toString();
- List<String> annotations = getAnnotations(element);
+ Map<String, Set<String>> annotations = getAnnotations(element);
classModel.addField(new FieldModel(name, type, annotations));
}
@@ -102,15 +104,15 @@
String name = element.getSimpleName().toString();
String returnType = executableElement.getReturnType().toString();
- List<String> annotations = getAnnotations(element);
+ Map<String, Set<String>> annotations = getAnnotations(element);
MethodModel method = new MethodModel(name, returnType, annotations);
for (VariableElement parameterElement : executableElement.getParameters())
{
String paramName = parameterElement.getSimpleName().toString();
String paramType = parameterElement.asType().toString();
- List<String> paramAnotations = getAnnotations(parameterElement);
- ParameterModel parameter = new ParameterModel(paramName, paramType,
paramAnotations);
+ Map<String, Set<String>> paramAnnotations =
getAnnotations(element);
+ ParameterModel parameter = new ParameterModel(paramName, paramType,
paramAnnotations);
method.addParameter(parameter);
}
// OK, cheating a little with a common model for methods and constructors
@@ -124,12 +126,17 @@
}
}
- public static List<String> getAnnotations(Element element)
+ private static Map<String, Set<String>> getAnnotations(Element element)
{
- List<String> annotations = new ArrayList<String>();
+ Map<String, Set<String>> annotations = new HashMap<String,
Set<String>>();
for (AnnotationMirror annotation : element.getAnnotationMirrors())
{
- annotations.add(annotation.getAnnotationType().toString());
+ Set<String> metaAnnotations = new HashSet<String>();
+ for (AnnotationMirror metaAnnotation :
annotation.getAnnotationType().asElement().getAnnotationMirrors())
+ {
+ metaAnnotations.add(metaAnnotation.getAnnotationType().toString());
+ }
+ annotations.put(annotation.getAnnotationType().toString(), metaAnnotations);
}
return annotations;
}
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/FieldModel.java
===================================================================
---
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/FieldModel.java 2009-03-16
07:16:55 UTC (rev 2026)
+++
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/FieldModel.java 2009-03-16
08:12:30 UTC (rev 2027)
@@ -17,19 +17,20 @@
package org.jboss.webbeans.xsd.model;
-import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* A model of a field
*
- * @author Nicklas Karlsosn
+ * @author Nicklas Karlsson
*
*/
public class FieldModel extends NamedModel
{
protected String type;
- public FieldModel(String name, String type, List<String> annotations)
+ public FieldModel(String name, String type, Map<String, Set<String>>
annotations)
{
super(name, annotations);
this.type = type;
Modified:
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/MethodModel.java
===================================================================
---
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/MethodModel.java 2009-03-16
07:16:55 UTC (rev 2026)
+++
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/MethodModel.java 2009-03-16
08:12:30 UTC (rev 2027)
@@ -19,6 +19,8 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* The model of a method
@@ -31,7 +33,7 @@
private String returnType;
private List<ParameterModel> parameters = new
ArrayList<ParameterModel>();
- public MethodModel(String name, String returnType, List<String> annotations)
+ public MethodModel(String name, String returnType, Map<String,
Set<String>> annotations)
{
super(name, annotations);
this.returnType = returnType;
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/NamedModel.java
===================================================================
---
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/NamedModel.java 2009-03-16
07:16:55 UTC (rev 2026)
+++
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/NamedModel.java 2009-03-16
08:12:30 UTC (rev 2027)
@@ -17,8 +17,8 @@
package org.jboss.webbeans.xsd.model;
-import java.util.HashSet;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
/**
@@ -30,35 +30,35 @@
public class NamedModel
{
protected String name;
- protected Set<String> annotations = new HashSet<String>();
+ protected Map<String, Set<String>> annotations = new HashMap<String,
Set<String>>();
public NamedModel()
{
}
- public NamedModel(String name, List<String> annotations)
+ public NamedModel(String name, Map<String, Set<String>> annotations)
{
this.name = name;
- this.annotations.addAll(annotations);
+ this.annotations.putAll(annotations);
}
- public void setAnnotations(List<String> annotations)
+ public String getName()
{
- this.annotations.addAll(annotations);
+ return name;
}
- public Set<String> getAnnotations()
+ public void setName(String name)
{
- return annotations;
+ this.name = name;
}
- public String getName()
+ public Map<String, Set<String>> getAnnotations()
{
- return name;
+ return annotations;
}
- public void setName(String name)
+ public void setAnnotations(Map<String, Set<String>> annotations)
{
- this.name = name;
+ this.annotations = annotations;
}
}
Modified:
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/ParameterModel.java
===================================================================
---
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/ParameterModel.java 2009-03-16
07:16:55 UTC (rev 2026)
+++
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/ParameterModel.java 2009-03-16
08:12:30 UTC (rev 2027)
@@ -17,7 +17,8 @@
package org.jboss.webbeans.xsd.model;
-import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* The model of a method or constrcutor parameter
@@ -28,7 +29,7 @@
public class ParameterModel extends FieldModel
{
- public ParameterModel(String name, String type, List<String> annotations)
+ public ParameterModel(String name, String type, Map<String, Set<String>>
annotations)
{
super(name, type, annotations);
}