Skip to content

Commit

Permalink
Switched from List to Collection parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
bbottema committed May 8, 2019
1 parent 7949cc3 commit 6f73f78
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/main/java/org/bbottema/javareflection/TypeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@
import org.jetbrains.annotations.Nullable;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;

import static org.bbottema.javareflection.LookupCaches.CACHED_COMPATIBLE_TARGET_TYPES;
import static org.bbottema.javareflection.LookupCaches.CACHED_REGISTERED_COMPATIBLE_TARGET_TYPES;
import static org.bbottema.javareflection.LookupCaches.addCompatiblesignaturesToCache;
import static org.bbottema.javareflection.LookupCaches.getCachedCompatibleSignatures;
import static org.bbottema.javareflection.LookupCaches.*;

/**
* Utility functions that deal with type information, conversions and autoboxing.
Expand Down Expand Up @@ -289,7 +281,7 @@ public static boolean isPackage(final String name) {

/**
* @return Whether a given list of Annotation contains a certain annotation type.
* @see #findAnnotation(List, Class)
* @see #findAnnotation(Collection, Class)
*/
@SuppressWarnings("WeakerAccess")
public static boolean containsAnnotation(List<Annotation> myListOfAnnotations, Class<? extends Annotation> annotationClass) {
Expand All @@ -300,7 +292,6 @@ public static boolean containsAnnotation(List<Annotation> myListOfAnnotations, C
* @return Whether a given list of Annotation contains a certain annotation type.
* @see #findAnnotation(Annotation[], Class)
*/
@SuppressWarnings("WeakerAccess")
public static boolean containsAnnotation(Annotation[] myListOfAnnotations, Class<? extends Annotation> annotationClass) {
return findAnnotation(myListOfAnnotations, annotationClass) != null;
}
Expand All @@ -311,7 +302,7 @@ public static boolean containsAnnotation(Annotation[] myListOfAnnotations, Class
*/
@SuppressWarnings({"WeakerAccess"})
@Nullable
public static <T extends Annotation> T findAnnotation(List<Annotation> myListOfAnnotations, Class<T> annotationClass) {
public static <T extends Annotation> T findAnnotation(Collection<Annotation> myListOfAnnotations, Class<T> annotationClass) {
return findAnnotation(myListOfAnnotations.toArray(new Annotation[0]), annotationClass);
}

Expand Down

0 comments on commit 6f73f78

Please sign in to comment.