config-prettyfaces/src/main/java/com/ocpsoft/pretty/faces/config/annotation/PrettyAnnotationHandler.java
private void processFieldAnnotations(Field field, String[] classMappingIds)
   {
      // Is there a @URLQueryParameter annotation?
      URLQueryParameter queryParamAnnotation = field.getAnnotation(URLQueryParameter.class);

      if (queryParamAnnotation != null)
      {

         // create a QueryParamSpec from the annotation
         QueryParamSpec queryParam = new QueryParamSpec();
         queryParam.setFieldName(field.getName());
         queryParam.setOwnerClass(field.getDeclaringClass());
         queryParam.setName(queryParamAnnotation.value());
         queryParam.setOnPostback(queryParamAnnotation.onPostback());

         // check which mapping the action belongs to
         if (!isBlank(queryParamAnnotation.mappingId()))
         {
            // action belongs to the mapping mentioned with mappingId attribute
            queryParam.setMappingIds(new String[] { queryParamAnnotation.mappingId().trim() });
         }
         else if (classMappingIds != null && classMappingIds.length > 0)
         {
            // use the mappings found on the class
            queryParam.setMappingIds(classMappingIds);
         }
         else
         {
            throw new IllegalArgumentException("Unable to find a suitable mapping "
                     + "for the query-parameter definied on field '" + field.getName() + "' in class '"
                     + field.getDeclaringClass().getName() + "'. Either place a @URLMapping annotation on the "
                     + "class or reference a foreign mapping using the 'mappingId' attribute.");
         }

         // check if there is also a validation annotation placed on the field
         URLValidator validationAnnotation = field.getAnnotation(URLValidator.class);

         // check if annotation has been found
         if (validationAnnotation != null)
         {

            // set validation options on the QueryParamSpec object
            queryParam.setValidatorIds(validationAnnotation.validatorIds());
            queryParam.setOnError(validationAnnotation.onError());
            queryParam.setValidator(validationAnnotation.validator());

         }

         // add the new spec object to the list of specs
         queryParamList.add(queryParam);

      }

   }
private void processFieldAnnotations(Field field, String[] classMappingIds)
   {
      // Is there a @URLQueryParameter annotation?
      URLQueryParameter queryParamAnnotation = field.getAnnotation(URLQueryParameter.class);

      if (queryParamAnnotation != null)
      {

         // create a QueryParamSpec from the annotation
         QueryParamSpec queryParam = new QueryParamSpec();
         queryParam.setFieldName(field.getName());
         queryParam.setOwnerClass(field.getDeclaringClass());
         queryParam.setName(queryParamAnnotation.value());
         queryParam.setOnPostback(queryParamAnnotation.onPostback());

         // check which mapping the action belongs to
         if (!isBlank(queryParamAnnotation.mappingId()))
         {
            // action belongs to the mapping mentioned with mappingId attribute
            queryParam.setMappingIds(new String[] { queryParamAnnotation.mappingId().trim() });
         }
         else if (classMappingIds != null && classMappingIds.length > 0)
         {
            // use the mappings found on the class
            queryParam.setMappingIds(classMappingIds);
         }
         else
         {
            throw new IllegalArgumentException("Unable to find a suitable mapping "
                     + "for the query-parameter definied on field '" + field.getName() + "' in class '"
                     + field.getDeclaringClass().getName() + "'. Either place a @URLMapping annotation on the "
                     + "class or reference a foreign mapping using the 'mappingId' attribute.");
         }

         // check if there is also a validation annotation placed on the field
         URLValidator validationAnnotation = field.getAnnotation(URLValidator.class);

         // check if annotation has been found
         if (validationAnnotation != null)
         {

            // set validation options on the QueryParamSpec object
            queryParam.setValidatorIds(validationAnnotation.validatorIds());
            queryParam.setOnError(validationAnnotation.onError());
            queryParam.setValidator(validationAnnotation.validator());

         }

         // add the new spec object to the list of specs
         queryParamList.add(queryParam);

      }

   }
private void processFieldAnnotations ( Field field , String [ ] classMappingIds ) { // Is there a @URLQueryParameter annotation? URLQueryParameter queryParamAnnotation = field . getAnnotation ( URLQueryParameter . class ) ; if ( queryParamAnnotation != null ) { // create a QueryParamSpec from the annotation QueryParamSpec queryParam = new QueryParamSpec ( ) ; queryParam . setFieldName ( field . getName ( ) ) ; queryParam . setOwnerClass ( field . getDeclaringClass ( ) ) ; queryParam . setName ( queryParamAnnotation . value ( ) ) ; queryParam . setOnPostback ( queryParamAnnotation . onPostback ( ) ) ; // check which mapping the action belongs to if ( ! isBlank ( queryParamAnnotation . mappingId ( ) ) ) { // action belongs to the mapping mentioned with mappingId attribute queryParam . setMappingIds ( new String [ ] { queryParamAnnotation . mappingId ( ) . trim ( ) } ) ; } else if ( classMappingIds != null && classMappingIds . length > 0 ) { // use the mappings found on the class queryParam . setMappingIds ( classMappingIds ) ; } else { throw new IllegalArgumentException ( "Unable to find a suitable mapping " + "for the query-parameter definied on field '" + field . getName ( ) + "' in class '" + field . getDeclaringClass ( ) . getName ( ) + "'. Either place a @URLMapping annotation on the " + "class or reference a foreign mapping using the 'mappingId' attribute." ) ; } // check if there is also a validation annotation placed on the field URLValidator validationAnnotation = field . getAnnotation ( URLValidator . class ) ; // check if annotation has been found if ( validationAnnotation != null ) { // set validation options on the QueryParamSpec object queryParam . setValidatorIds ( validationAnnotation . validatorIds ( ) ) ; queryParam . setOnError ( validationAnnotation . onError ( ) ) ; queryParam . setValidator ( validationAnnotation . validator ( ) ) ; } // add the new spec object to the list of specs queryParamList . add ( queryParam ) ; } }
Searches for {@link URLQueryParameter} annotations on a single field.

@param field Field to scan
@param classMappingIds The mapping IDs of the class this method belongs to
Searches for { @link URLQueryParameter } annotations on a single field .