getClassValueFromAnnotation(
return Optional.empty();
}
+ /**
+ * Finds a list of type mirrors for classes defined as an annotation parameter.
+ *
+ * For example:
+ *
+ *
+ * interface @MyAnnotation {
+ * Class<?>[] myClasses();
+ * }
+ *
+ *
+ *
+ *
+ * @param element the element
+ * @param annotation the annotation
+ * @param paramName the class parameter name
+ * @return The list of type mirrors for the classes, empty list otherwise
+ */
+ public List getClassArrayValueFromAnnotation(
+ Element element, Class extends Annotation> annotation, String paramName) {
+
+ List values = new ArrayList<>();
+
+ for (AnnotationMirror am : element.getAnnotationMirrors()) {
+ if (env.types()
+ .isSameType(
+ am.getAnnotationType(),
+ env.elements().getTypeElement(annotation.getCanonicalName()).asType())) {
+ for (Map.Entry extends ExecutableElement, ? extends AnnotationValue> entry :
+ am.getElementValues().entrySet()) {
+ if (paramName.equals(entry.getKey().getSimpleName().toString())) {
+ List classesTypes =
+ (List) entry.getValue().getValue();
+ Iterator extends AnnotationValue> iterator = classesTypes.iterator();
+
+ while (iterator.hasNext()) {
+ AnnotationValue next = iterator.next();
+ values.add((TypeMirror) next.getValue());
+ }
+ }
+ }
+ }
+ }
+ return values;
+ }
+
/**
* isAssignableFrom. checks if a specific {@link TypeMirror} is assignable from a specific {@link
* java.lang.Class}.
diff --git a/domino-auto-api/src/main/java/org/dominokit/auto/DominoAutoService.java b/domino-auto-processor/src/test/java/org/dominokit/auto/TestService.java
similarity index 92%
rename from domino-auto-api/src/main/java/org/dominokit/auto/DominoAutoService.java
rename to domino-auto-processor/src/test/java/org/dominokit/auto/TestService.java
index 959a7a2..cbef1f4 100644
--- a/domino-auto-api/src/main/java/org/dominokit/auto/DominoAutoService.java
+++ b/domino-auto-processor/src/test/java/org/dominokit/auto/TestService.java
@@ -15,4 +15,6 @@
*/
package org.dominokit.auto;
-public interface DominoAutoService {}
+public interface TestService {
+ void init();
+}
diff --git a/domino-auto-processor/src/test/java/org/dominokit/auto/TestServiceImpl.java b/domino-auto-processor/src/test/java/org/dominokit/auto/TestServiceImpl.java
new file mode 100644
index 0000000..7537eb1
--- /dev/null
+++ b/domino-auto-processor/src/test/java/org/dominokit/auto/TestServiceImpl.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright © 2019 Dominokit
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.dominokit.auto;
+
+import com.google.auto.service.AutoService;
+
+@AutoService(TestService.class)
+public class TestServiceImpl implements TestService {
+ @Override
+ public void init() {}
+}
diff --git a/pom.xml b/pom.xml
index 1987fd3..1680bc4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.dominokit
domino-auto
- 1.0.0
+ 1.0.1
pom
domino-auto
@@ -66,7 +66,7 @@
HEAD-SNAPSHOT
- 1.0.0
+ 1.0.1
11
11
UTF-8