Skip to content

Commit

Permalink
HSEARCH-3046 Remove some unused methods form AnnotationHelper
Browse files Browse the repository at this point in the history
Keeping it a different commit, since it is possible that we will restore them for further mappings.
  • Loading branch information
fax4ever authored and yrodiere committed Jun 12, 2019
1 parent 188b9b5 commit 5216e79
Showing 1 changed file with 0 additions and 19 deletions.
Expand Up @@ -10,12 +10,10 @@
import java.lang.annotation.Repeatable;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;

import org.hibernate.search.mapper.pojo.logging.impl.Log;
Expand All @@ -33,23 +31,6 @@ public AnnotationHelper(MethodHandles.Lookup lookup) {
this.lookup = lookup;
}

public <A extends Annotation> Optional<A> getAnnotationByType(
AnnotatedElement annotatedElement, Class<A> annotationType) {
return Optional.ofNullable( annotatedElement.getAnnotation( annotationType ) );
}

public <A extends Annotation> Stream<A> getAnnotationsByType(
AnnotatedElement annotatedElement, Class<A> annotationType) {
return Arrays.stream( annotatedElement.getAnnotationsByType( annotationType ) );
}

public Stream<? extends Annotation> getAnnotationsByMetaAnnotationType(
AnnotatedElement annotatedElement, Class<? extends Annotation> metaAnnotationType) {
return Arrays.stream( annotatedElement.getAnnotations() )
.flatMap( this::expandRepeatableContainingAnnotation )
.filter( annotation -> isMetaAnnotated( annotation, metaAnnotationType ) );
}

public boolean isMetaAnnotated(Annotation annotation, Class<? extends Annotation> metaAnnotationType) {
return annotation.annotationType().getAnnotationsByType( metaAnnotationType ).length > 0;
}
Expand Down

0 comments on commit 5216e79

Please sign in to comment.