Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasstamann committed Nov 11, 2023
2 parents 4606e91 + b41fa7f commit f5f10db
Show file tree
Hide file tree
Showing 22 changed files with 51 additions and 20 deletions.
2 changes: 1 addition & 1 deletion annotationwrapper/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-annotationwrapper-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-annotationwrapper-api</name>
Expand Down
2 changes: 1 addition & 1 deletion annotationwrapper/integrationtest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-annotationwrapper-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-annotationwrapper-integrationTest</name>
Expand Down
2 changes: 1 addition & 1 deletion annotationwrapper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>


Expand Down
2 changes: 1 addition & 1 deletion annotationwrapper/processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-annotationwrapper-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-annotationwrapper-processor</name>
Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-common</name>
Expand Down
2 changes: 1 addition & 1 deletion compilermessages/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-compilermessages-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-compilermessages-api</name>
Expand Down
2 changes: 1 addition & 1 deletion compilermessages/integrationtest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-compilermessages-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-compilermessages-integrationTest</name>
Expand Down
2 changes: 1 addition & 1 deletion compilermessages/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>


Expand Down
2 changes: 1 addition & 1 deletion compilermessages/processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-compilermessages-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-compilermessages-processor</name>
Expand Down
2 changes: 1 addition & 1 deletion cute/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-cute</name>
Expand Down
4 changes: 2 additions & 2 deletions example/example-annotationprocessor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-example-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-example-annotationprocessor</name>
Expand Down Expand Up @@ -114,7 +114,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<version>3.3.0</version>
<executions>
<execution>
<id>add-resource</id>
Expand Down
2 changes: 1 addition & 1 deletion example/example-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-example-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-example-annotations</name>
Expand Down
2 changes: 1 addition & 1 deletion example/example-usecase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-example-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-example-usecase</name>
Expand Down
2 changes: 1 addition & 1 deletion example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-example-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion extensions/java9/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>extension-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-tools-java9</name>
Expand Down
2 changes: 1 addition & 1 deletion extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>extension-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
<packaging>pom</packaging>

<name>aptk-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion templating/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-templating</name>
Expand Down
2 changes: 1 addition & 1 deletion tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.7</version>
<version>0.22.8</version>
</parent>

<name>aptk-tools</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ public TypeElementWrapper getAnnotationTypeAsWrappedTypeElement() {
return getAnnotationTypeAsWrappedTypeMirror().getTypeElement().get();
}


/**
* Gets the wrapped type mirror of the 'value' annotation attribute.
* @return an optional containing the wrapped type mirror of the annotation attribute or an empty Optional if the attribute doesn't exist.
*/
public Optional<TypeMirrorWrapper> getAttributeTypeMirror() {
return getAttributeTypeMirror("value");
}

/**
* Gets the wrapped type mirror of an annotation attribute.
* @param attributeName the name of the attribute
* @return an optional containing the wrapped type mirror of the annotation attribute or an empty Optional if the attribute doesn't exist.
*/
public Optional<TypeMirrorWrapper> getAttributeTypeMirror(String attributeName) {
Optional<ExecutableElementWrapper> annotationAttribute = this.getAnnotationTypeAsWrappedTypeElement().getMethod(attributeName);
return !annotationAttribute.isPresent() ? Optional.empty() : Optional.of(annotationAttribute.get().getReturnType());
}


/**
* Returns the "value" attribute
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public List<TypeParameterElementWrapper> getTypeParameters() {
public Optional<ExecutableElementWrapper> getMethod(String name, Class<?>... parameterTypes) {
List<ExecutableElement> filterResult = FluentElementFilter.createFluentElementFilter(this.element.getEnclosedElements())
.applyFilter(AptkCoreMatchers.IS_METHOD)
.applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf(name)
.applyFilter(AptkCoreMatchers.BY_PARAMETER_TYPE).filterByOneOf(parameterTypes)
.getResult();
return Optional.ofNullable(filterResult.size() > 0 ? ExecutableElementWrapper.wrap(filterResult.get(0)) : null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ public void test_wrap_null() {
AnnotationMirrorWrapper.wrap((AnnotationMirror) null);
}


@Test
public void test_getAttributesTypeMirror() {
CompileTestBuilder.unitTest().<TypeElement>defineTestWithPassedInElement(MyTestClass.class, (processingEnvironment, element) -> {
AnnotationMirrorWrapper unit = ElementWrapper.wrap(element).getAnnotationMirror(MyTestAnnotation.class).get();

MatcherAssert.assertThat(unit.getAttributeTypeMirror().get().getSimpleName(), Matchers.is("String"));
}).executeTest();
}

@Test
public void test_getAttribute() {

Expand Down

0 comments on commit f5f10db

Please sign in to comment.