4343import com .ocpsoft .pretty .faces .el .LazyExpression ;
4444import com .ocpsoft .pretty .faces .el .PrettyExpression ;
4545
46- @ SuppressWarnings ("unchecked" )
4746public class PrettyAnnotationHandler
4847{
4948
@@ -60,7 +59,7 @@ public class PrettyAnnotationHandler
6059 /**
6160 * A map to resolve the bean name for a {@link Class} object
6261 */
63- private final Map <Class , String > beanNameMap = new HashMap <Class , String >();
62+ private final Map <Class <?> , String > beanNameMap = new HashMap <Class <?> , String >();
6463
6564 /**
6665 * The {@link ActionSpec} objects generated from annotation scanning
@@ -86,13 +85,12 @@ public PrettyAnnotationHandler(LazyBeanNameFinder beanNameFinder)
8685 }
8786
8887 /**
89- * This method scans the supplied class for PrettyFaces annotations. The
90- * method must be called for every class that should be scanner before
91- * finally calling {@link #build(PrettyConfigBuilder)}.
88+ * This method scans the supplied class for PrettyFaces annotations. The method must be called for every class that
89+ * should be scanner before finally calling {@link #build(PrettyConfigBuilder)}.
9290 *
9391 * @param clazz The class to scan
9492 */
95- public void processClass (Class clazz )
93+ public void processClass (Class <?> clazz )
9694 {
9795
9896 // log class name on trace level
@@ -135,11 +133,10 @@ public void processClass(Class clazz)
135133 /**
136134 * Checks for PrettyFaces mapping annotations on a single class
137135 *
138- * @param clazz
139- * Class to scan
136+ * @param clazz Class to scan
140137 * @return The IDs of the mappings found on the class
141138 */
142- public String [] processClassMappingAnnotations (Class clazz )
139+ public String [] processClassMappingAnnotations (Class <?> clazz )
143140 {
144141
145142 // list of all mapping IDs found on the class
@@ -174,15 +171,15 @@ public String[] processClassMappingAnnotations(Class clazz)
174171 return classMappingIds .toArray (new String [classMappingIds .size ()]);
175172
176173 }
177-
174+
178175 /**
179176 * Process a single {@link URLMapping} annotation.
180177 *
181178 * @param clazz The class that the annotation was found on
182179 * @param mappingAnnotation The annotation to process
183180 * @return The mapping ID of the mapping found
184181 */
185- private String processPrettyMappingAnnotation (Class clazz , URLMapping mappingAnnotation )
182+ private String processPrettyMappingAnnotation (Class <?> clazz , URLMapping mappingAnnotation )
186183 {
187184
188185 // log class name
@@ -223,7 +220,8 @@ private String processPrettyMappingAnnotation(Class clazz, URLMapping mappingAnn
223220 if (validationAnnotation .index () < 0 )
224221 {
225222 throw new IllegalArgumentException (
226- "Please set the index of the path parameter you want to validate with the @URLValidator specified on mapping: " + mapping .getId ());
223+ "Please set the index of the path parameter you want to validate with the @URLValidator specified on mapping: "
224+ + mapping .getId ());
227225 }
228226
229227 // prepare PathValidator
@@ -253,7 +251,7 @@ private String processPrettyMappingAnnotation(Class clazz, URLMapping mappingAnn
253251 *
254252 * @param clazz Class to scan
255253 */
256- private void processPrettyBeanAnnotation (Class clazz )
254+ private void processPrettyBeanAnnotation (Class <?> clazz )
257255 {
258256
259257 // get reference to @URLMapping annotation
@@ -277,8 +275,7 @@ private void processPrettyBeanAnnotation(Class clazz)
277275 }
278276
279277 /**
280- * Searches for {@link URLAction} or {@link URLActions} annotations on a
281- * method.
278+ * Searches for {@link URLAction} or {@link URLActions} annotations on a method.
282279 *
283280 * @param method Method to scan
284281 * @param classMappingIds The mapping IDs of the class this method belongs to
@@ -340,9 +337,9 @@ else if (classMappingIds != null && classMappingIds.length > 0)
340337 else
341338 {
342339 throw new IllegalArgumentException ("Unable to find a suitable mapping "
343- + "for the query-parameter definied on field '" + field .getName () + "' in class '"
344- + field .getDeclaringClass ().getName () + "'. Either place a @URLMapping annotation on the "
345- + "class or reference a foreign mapping using the 'mappingId' attribute." );
340+ + "for the query-parameter definied on field '" + field .getName () + "' in class '"
341+ + field .getDeclaringClass ().getName () + "'. Either place a @URLMapping annotation on the "
342+ + "class or reference a foreign mapping using the 'mappingId' attribute." );
346343 }
347344
348345 // check if there is also a validation annotation placed on the field
@@ -367,8 +364,7 @@ else if (classMappingIds != null && classMappingIds.length > 0)
367364 }
368365
369366 /**
370- * Creates a {@link UrlAction} object from the supplied {@link URLAction}
371- * annotation
367+ * Creates a {@link UrlAction} object from the supplied {@link URLAction} annotation
372368 *
373369 * @param actionAnnotation The annotation
374370 * @param method The method that was annotated
@@ -390,18 +386,18 @@ private void processPrettyActionAnnotation(URLAction actionAnnotation, Method me
390386 // action belongs to the mapping mentioned with mappingId attribute
391387 actionSpec .setMappingIds (new String [] { actionAnnotation .mappingId ().trim () });
392388 }
393- else if ( classMappingIds != null && classMappingIds .length > 0 )
389+ else if (classMappingIds != null && classMappingIds .length > 0 )
394390 {
395391 // use the mapping found on the class
396- actionSpec .setMappingIds ( classMappingIds );
392+ actionSpec .setMappingIds (classMappingIds );
397393 }
398394 else
399395 {
400396 // No mapping found... throw an exception..
401397 throw new IllegalArgumentException ("Unable to find a suitable mapping "
402- + "for the action definied on method '" + method .getName () + "' in class '"
403- + method .getDeclaringClass ().getName () + "'. Either place a @URLMapping annotation on the "
404- + "class or reference a foreign mapping using the 'mappingId' attribute." );
398+ + "for the action definied on method '" + method .getName () + "' in class '"
399+ + method .getDeclaringClass ().getName () + "'. Either place a @URLMapping annotation on the "
400+ + "class or reference a foreign mapping using the 'mappingId' attribute." );
405401 }
406402
407403 // add action to list of actions
@@ -413,18 +409,16 @@ else if ( classMappingIds != null && classMappingIds.length > 0 )
413409 * Returns <code>true</code> for "blank" strings.
414410 *
415411 * @param str Input string
416- * @return <code>true</code> if string is <code>null</code> or trimmed value
417- * is empty
412+ * @return <code>true</code> if string is <code>null</code> or trimmed value is empty
418413 */
419414 private static boolean isBlank (String str )
420415 {
421416 return (str == null ) || (str .trim ().length () == 0 );
422417 }
423418
424419 /**
425- * This methods adds all mappings found to the supplied
426- * {@link PrettyConfigBuilder}. It should be called after all classes has
427- * been scanned via {@link #processClass(Class)}.
420+ * This methods adds all mappings found to the supplied {@link PrettyConfigBuilder}. It should be called after all
421+ * classes has been scanned via {@link #processClass(Class)}.
428422 *
429423 * @param builder The builder to add the mappings to
430424 */
@@ -451,8 +445,8 @@ public void build(PrettyConfigBuilder builder)
451445 if (mapping == null )
452446 {
453447 throw new IllegalArgumentException ("Unable to find the mapping '" + mappingId
454- + "' referenced at method '" + actionSpec .getMethod ().getName () + "' in class '"
455- + actionSpec .getMethod ().getDeclaringClass ().getName () + "'." );
448+ + "' referenced at method '" + actionSpec .getMethod ().getName () + "' in class '"
449+ + actionSpec .getMethod ().getDeclaringClass ().getName () + "'." );
456450 }
457451
458452 // build UrlMapping
@@ -462,7 +456,7 @@ public void build(PrettyConfigBuilder builder)
462456 urlAction .setInheritable (actionSpec .isInheritable ());
463457
464458 // try to get bean name
465- Class clazz = actionSpec .getMethod ().getDeclaringClass ();
459+ Class <?> clazz = actionSpec .getMethod ().getDeclaringClass ();
466460
467461 // build expression
468462 PrettyExpression expression = buildPrettyExpression (clazz , actionSpec .getMethod ().getName ());
@@ -494,8 +488,8 @@ public void build(PrettyConfigBuilder builder)
494488 if (mapping == null )
495489 {
496490 throw new IllegalArgumentException ("Unable to find the mapping '" + mappingId
497- + "' referenced at field '" + queryParamSpec .getFieldName () + "' in class '"
498- + queryParamSpec .getOwnerClass ().getName () + "'." );
491+ + "' referenced at field '" + queryParamSpec .getFieldName () + "' in class '"
492+ + queryParamSpec .getOwnerClass ().getName () + "'." );
499493 }
500494
501495 // build UrlMapping
@@ -522,7 +516,7 @@ public void build(PrettyConfigBuilder builder)
522516 if (log .isTraceEnabled ())
523517 {
524518 log .trace ("Registered query-param '" + queryParam .getName () + "' to '" + expression + "' in mapping: "
525- + mapping .getId ());
519+ + mapping .getId ());
526520 }
527521
528522 // register this action
@@ -540,8 +534,8 @@ public void build(PrettyConfigBuilder builder)
540534 }
541535
542536 /**
543- * Creates a {@link PrettyExpression} for a class and component. This method
544- * may return a {@link ConstantExpression} or a {@link LazyExpression}.
537+ * Creates a {@link PrettyExpression} for a class and component. This method may return a {@link ConstantExpression}
538+ * or a {@link LazyExpression}.
545539 *
546540 * @param clazz The class of the bean
547541 * @param component the component (property or method name)
0 commit comments