11/*
2- * Copyright 2002-2017 the original author or authors.
2+ * Copyright 2002-2018 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
3030
3131import org .springframework .core .BridgeMethodResolver ;
3232import org .springframework .lang .Nullable ;
33- import org .springframework .util .Assert ;
3433import org .springframework .util .LinkedMultiValueMap ;
3534import org .springframework .util .MultiValueMap ;
3635
@@ -154,9 +153,6 @@ public Annotation[] getDeclaredAnnotations() {
154153 * @see #hasMetaAnnotationTypes
155154 */
156155 public static Set <String > getMetaAnnotationTypes (AnnotatedElement element , Class <? extends Annotation > annotationType ) {
157- Assert .notNull (element , "AnnotatedElement must not be null" );
158- Assert .notNull (annotationType , "'annotationType' must not be null" );
159-
160156 return getMetaAnnotationTypes (element , element .getAnnotation (annotationType ));
161157 }
162158
@@ -175,9 +171,6 @@ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, Class
175171 * @see #hasMetaAnnotationTypes
176172 */
177173 public static Set <String > getMetaAnnotationTypes (AnnotatedElement element , String annotationName ) {
178- Assert .notNull (element , "AnnotatedElement must not be null" );
179- Assert .hasLength (annotationName , "'annotationName' must not be null or empty" );
180-
181174 return getMetaAnnotationTypes (element , AnnotationUtils .getAnnotation (element , annotationName ));
182175 }
183176
@@ -217,9 +210,6 @@ public Object process(@Nullable AnnotatedElement annotatedElement, Annotation an
217210 * @see #getMetaAnnotationTypes
218211 */
219212 public static boolean hasMetaAnnotationTypes (AnnotatedElement element , Class <? extends Annotation > annotationType ) {
220- Assert .notNull (element , "AnnotatedElement must not be null" );
221- Assert .notNull (annotationType , "'annotationType' must not be null" );
222-
223213 return hasMetaAnnotationTypes (element , annotationType , null );
224214 }
225215
@@ -236,9 +226,6 @@ public static boolean hasMetaAnnotationTypes(AnnotatedElement element, Class<? e
236226 * @see #getMetaAnnotationTypes
237227 */
238228 public static boolean hasMetaAnnotationTypes (AnnotatedElement element , String annotationName ) {
239- Assert .notNull (element , "AnnotatedElement must not be null" );
240- Assert .hasLength (annotationName , "'annotationName' must not be null or empty" );
241-
242229 return hasMetaAnnotationTypes (element , null , annotationName );
243230 }
244231
@@ -271,14 +258,10 @@ public Boolean process(@Nullable AnnotatedElement annotatedElement, Annotation a
271258 * @see #hasAnnotation(AnnotatedElement, Class)
272259 */
273260 public static boolean isAnnotated (AnnotatedElement element , Class <? extends Annotation > annotationType ) {
274- Assert .notNull (element , "AnnotatedElement must not be null" );
275- Assert .notNull (annotationType , "'annotationType' must not be null" );
276-
277261 // Shortcut: directly present on the element, with no processing needed?
278262 if (element .isAnnotationPresent (annotationType )) {
279263 return true ;
280264 }
281-
282265 return Boolean .TRUE .equals (searchWithGetSemantics (element , annotationType , null , alwaysTrueAnnotationProcessor ));
283266 }
284267
@@ -295,9 +278,6 @@ public static boolean isAnnotated(AnnotatedElement element, Class<? extends Anno
295278 * @return {@code true} if a matching annotation is present
296279 */
297280 public static boolean isAnnotated (AnnotatedElement element , String annotationName ) {
298- Assert .notNull (element , "AnnotatedElement must not be null" );
299- Assert .hasLength (annotationName , "'annotationName' must not be null or empty" );
300-
301281 return Boolean .TRUE .equals (searchWithGetSemantics (element , null , annotationName , alwaysTrueAnnotationProcessor ));
302282 }
303283
@@ -322,7 +302,6 @@ public static boolean isAnnotated(AnnotatedElement element, String annotationNam
322302 public static AnnotationAttributes getMergedAnnotationAttributes (
323303 AnnotatedElement element , Class <? extends Annotation > annotationType ) {
324304
325- Assert .notNull (annotationType , "'annotationType' must not be null" );
326305 AnnotationAttributes attributes = searchWithGetSemantics (element , annotationType , null ,
327306 new MergedAnnotationAttributesProcessor ());
328307 AnnotationUtils .postProcessAnnotationAttributes (element , attributes , false , false );
@@ -382,7 +361,6 @@ public static AnnotationAttributes getMergedAnnotationAttributes(AnnotatedElemen
382361 public static AnnotationAttributes getMergedAnnotationAttributes (AnnotatedElement element ,
383362 String annotationName , boolean classValuesAsString , boolean nestedAnnotationsAsMap ) {
384363
385- Assert .hasLength (annotationName , "'annotationName' must not be null or empty" );
386364 AnnotationAttributes attributes = searchWithGetSemantics (element , null , annotationName ,
387365 new MergedAnnotationAttributesProcessor (classValuesAsString , nestedAnnotationsAsMap ));
388366 AnnotationUtils .postProcessAnnotationAttributes (element , attributes , classValuesAsString , nestedAnnotationsAsMap );
@@ -409,8 +387,6 @@ public static AnnotationAttributes getMergedAnnotationAttributes(AnnotatedElemen
409387 */
410388 @ Nullable
411389 public static <A extends Annotation > A getMergedAnnotation (AnnotatedElement element , Class <A > annotationType ) {
412- Assert .notNull (annotationType , "'annotationType' must not be null" );
413-
414390 // Shortcut: directly present on the element, with no merging needed?
415391 if (!(element instanceof Class )) {
416392 // Do not use this shortcut against a Class: Inherited annotations
@@ -446,12 +422,7 @@ public static <A extends Annotation> A getMergedAnnotation(AnnotatedElement elem
446422 * @see #getAllAnnotationAttributes(AnnotatedElement, String)
447423 * @see #findAllMergedAnnotations(AnnotatedElement, Class)
448424 */
449- public static <A extends Annotation > Set <A > getAllMergedAnnotations (AnnotatedElement element ,
450- Class <A > annotationType ) {
451-
452- Assert .notNull (element , "AnnotatedElement must not be null" );
453- Assert .notNull (annotationType , "'annotationType' must not be null" );
454-
425+ public static <A extends Annotation > Set <A > getAllMergedAnnotations (AnnotatedElement element , Class <A > annotationType ) {
455426 MergedAnnotationAttributesProcessor processor = new MergedAnnotationAttributesProcessor (false , false , true );
456427 searchWithGetSemantics (element , annotationType , null , processor );
457428 return postProcessAndSynthesizeAggregatedResults (element , annotationType , processor .getAggregatedResults ());
@@ -516,9 +487,6 @@ public static <A extends Annotation> Set<A> getMergedRepeatableAnnotations(Annot
516487 public static <A extends Annotation > Set <A > getMergedRepeatableAnnotations (AnnotatedElement element ,
517488 Class <A > annotationType , @ Nullable Class <? extends Annotation > containerType ) {
518489
519- Assert .notNull (element , "AnnotatedElement must not be null" );
520- Assert .notNull (annotationType , "'annotationType' must not be null" );
521-
522490 if (containerType == null ) {
523491 containerType = resolveContainerType (annotationType );
524492 }
@@ -603,14 +571,10 @@ public Object process(@Nullable AnnotatedElement annotatedElement, Annotation an
603571 * @see #isAnnotated(AnnotatedElement, Class)
604572 */
605573 public static boolean hasAnnotation (AnnotatedElement element , Class <? extends Annotation > annotationType ) {
606- Assert .notNull (element , "AnnotatedElement must not be null" );
607- Assert .notNull (annotationType , "'annotationType' must not be null" );
608-
609574 // Shortcut: directly present on the element, with no processing needed?
610575 if (element .isAnnotationPresent (annotationType )) {
611576 return true ;
612577 }
613-
614578 return Boolean .TRUE .equals (searchWithFindSemantics (element , annotationType , null , alwaysTrueAnnotationProcessor ));
615579 }
616580
@@ -710,8 +674,6 @@ public static AnnotationAttributes findMergedAnnotationAttributes(AnnotatedEleme
710674 */
711675 @ Nullable
712676 public static <A extends Annotation > A findMergedAnnotation (AnnotatedElement element , Class <A > annotationType ) {
713- Assert .notNull (annotationType , "'annotationType' must not be null" );
714-
715677 // Shortcut: directly present on the element, with no merging needed?
716678 if (!(element instanceof Class )) {
717679 // Do not use this shortcut against a Class: Inherited annotations
@@ -746,12 +708,7 @@ public static <A extends Annotation> A findMergedAnnotation(AnnotatedElement ele
746708 * @see #findMergedAnnotation(AnnotatedElement, Class)
747709 * @see #getAllMergedAnnotations(AnnotatedElement, Class)
748710 */
749- public static <A extends Annotation > Set <A > findAllMergedAnnotations (AnnotatedElement element ,
750- Class <A > annotationType ) {
751-
752- Assert .notNull (element , "AnnotatedElement must not be null" );
753- Assert .notNull (annotationType , "'annotationType' must not be null" );
754-
711+ public static <A extends Annotation > Set <A > findAllMergedAnnotations (AnnotatedElement element , Class <A > annotationType ) {
755712 MergedAnnotationAttributesProcessor processor = new MergedAnnotationAttributesProcessor (false , false , true );
756713 searchWithFindSemantics (element , annotationType , null , processor );
757714 return postProcessAndSynthesizeAggregatedResults (element , annotationType , processor .getAggregatedResults ());
@@ -816,9 +773,6 @@ public static <A extends Annotation> Set<A> findMergedRepeatableAnnotations(Anno
816773 public static <A extends Annotation > Set <A > findMergedRepeatableAnnotations (AnnotatedElement element ,
817774 Class <A > annotationType , @ Nullable Class <? extends Annotation > containerType ) {
818775
819- Assert .notNull (element , "AnnotatedElement must not be null" );
820- Assert .notNull (annotationType , "'annotationType' must not be null" );
821-
822776 if (containerType == null ) {
823777 containerType = resolveContainerType (annotationType );
824778 }
@@ -902,8 +856,6 @@ private static <T> T searchWithGetSemantics(AnnotatedElement element,
902856 @ Nullable Class <? extends Annotation > containerType , Processor <T > processor ,
903857 Set <AnnotatedElement > visited , int metaDepth ) {
904858
905- Assert .notNull (element , "AnnotatedElement must not be null" );
906-
907859 if (visited .add (element )) {
908860 try {
909861 // Start searching within locally declared annotations
@@ -1096,8 +1048,6 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element,
10961048 @ Nullable Class <? extends Annotation > containerType , Processor <T > processor ,
10971049 Set <AnnotatedElement > visited , int metaDepth ) {
10981050
1099- Assert .notNull (element , "AnnotatedElement must not be null" );
1100-
11011051 if (visited .add (element )) {
11021052 try {
11031053 // Locally declared annotations (ignoring @Inherited)
0 commit comments