config-prettyfaces/src/main/java/com/ocpsoft/pretty/faces/config/annotation/PrettyAnnotationHandler.java
private String processPrettyMappingAnnotation(Class<?> clazz, URLMapping mappingAnnotation)
   {

      // log class name
      if (log.isTraceEnabled())
      {
         log.trace("Found @URLMapping annotation on class: " + clazz.getName());
      }

      // create UrlMapping from annotation
      UrlMapping mapping = new UrlMapping();
      mapping.setId(mappingAnnotation.id());
      mapping.setParentId(mappingAnnotation.parentId());
      mapping.setPattern(mappingAnnotation.pattern());
      mapping.setViewId(mappingAnnotation.viewId());
      mapping.setOutbound(mappingAnnotation.outbound());
      mapping.setOnPostback(mappingAnnotation.onPostback());

      // register mapping
      Object existingMapping = urlMappings.put(mapping.getId(), mapping);

      // fail if a mapping with this ID already existed
      if (existingMapping != null)
      {
         throw new IllegalArgumentException("Duplicated mapping id: " + mapping.getId());
      }

      // At bean name to lookup map if it has been specified
      if ((mappingAnnotation.beanName() != null) && (mappingAnnotation.beanName().length() > 0))
      {
         beanNameMap.put(clazz, mappingAnnotation.beanName());
      }

      // process validations
      for (URLValidator validationAnnotation : mappingAnnotation.validation())
      {

         // index attribute is required in this case
         if (validationAnnotation.index() < 0)
         {
            throw new IllegalArgumentException(
                     "Please set the index of the path parameter you want to validate with the @URLValidator specified on mapping: "
                              + mapping.getId());
         }

         // prepare PathValidator
         PathValidator pathValidator = new PathValidator();
         pathValidator.setIndex(validationAnnotation.index());
         pathValidator.setOnError(validationAnnotation.onError());
         pathValidator.setValidatorIds(join(validationAnnotation.validatorIds(), " "));

         // optional validator method
         if (!isBlank(validationAnnotation.validator()))
         {
            pathValidator.setValidatorExpression(new ConstantExpression(validationAnnotation.validator()));
         }

         // add PathValidator to the mapping
         mapping.getPathValidators().add(pathValidator);

      }

      // return mapping id
      return mapping.getId().trim();

   }
private String processPrettyMappingAnnotation(Class<?> clazz, URLMapping mappingAnnotation)
   {

      // log class name
      if (log.isTraceEnabled())
      {
         log.trace("Found @URLMapping annotation on class: " + clazz.getName());
      }

      // create UrlMapping from annotation
      UrlMapping mapping = new UrlMapping();
      mapping.setId(mappingAnnotation.id());
      mapping.setParentId(mappingAnnotation.parentId());
      mapping.setPattern(mappingAnnotation.pattern());
      mapping.setViewId(mappingAnnotation.viewId());
      mapping.setOutbound(mappingAnnotation.outbound());
      mapping.setOnPostback(mappingAnnotation.onPostback());

      // register mapping
      Object existingMapping = urlMappings.put(mapping.getId(), mapping);

      // fail if a mapping with this ID already existed
      if (existingMapping != null)
      {
         throw new IllegalArgumentException("Duplicated mapping id: " + mapping.getId());
      }

      // At bean name to lookup map if it has been specified
      if ((mappingAnnotation.beanName() != null) && (mappingAnnotation.beanName().length() > 0))
      {
         beanNameMap.put(clazz, mappingAnnotation.beanName());
      }

      // process validations
      for (URLValidator validationAnnotation : mappingAnnotation.validation())
      {

         // index attribute is required in this case
         if (validationAnnotation.index() < 0)
         {
            throw new IllegalArgumentException(
                     "Please set the index of the path parameter you want to validate with the @URLValidator specified on mapping: "
                              + mapping.getId());
         }

         // prepare PathValidator
         PathValidator pathValidator = new PathValidator();
         pathValidator.setIndex(validationAnnotation.index());
         pathValidator.setOnError(validationAnnotation.onError());
         pathValidator.setValidatorIds(join(validationAnnotation.validatorIds(), " "));

         // optional validator method
         if (!isBlank(validationAnnotation.validator()))
         {
            pathValidator.setValidatorExpression(new ConstantExpression(validationAnnotation.validator()));
         }

         // add PathValidator to the mapping
         mapping.getPathValidators().add(pathValidator);

      }

      // return mapping id
      return mapping.getId().trim();

   }
private String processPrettyMappingAnnotation ( Class < ? > clazz , URLMapping mappingAnnotation ) { // log class name if ( log . isTraceEnabled ( ) ) { log . trace ( "Found @URLMapping annotation on class: " + clazz . getName ( ) ) ; } // create UrlMapping from annotation UrlMapping mapping = new UrlMapping ( ) ; mapping . setId ( mappingAnnotation . id ( ) ) ; mapping . setParentId ( mappingAnnotation . parentId ( ) ) ; mapping . setPattern ( mappingAnnotation . pattern ( ) ) ; mapping . setViewId ( mappingAnnotation . viewId ( ) ) ; mapping . setOutbound ( mappingAnnotation . outbound ( ) ) ; mapping . setOnPostback ( mappingAnnotation . onPostback ( ) ) ; // register mapping Object existingMapping = urlMappings . put ( mapping . getId ( ) , mapping ) ; // fail if a mapping with this ID already existed if ( existingMapping != null ) { throw new IllegalArgumentException ( "Duplicated mapping id: " + mapping . getId ( ) ) ; } // At bean name to lookup map if it has been specified if ( ( mappingAnnotation . beanName ( ) != null ) && ( mappingAnnotation . beanName ( ) . length ( ) > 0 ) ) { beanNameMap . put ( clazz , mappingAnnotation . beanName ( ) ) ; } // process validations for ( URLValidator validationAnnotation : mappingAnnotation . validation ( ) ) { // index attribute is required in this case if ( validationAnnotation . index ( ) < 0 ) { throw new IllegalArgumentException ( "Please set the index of the path parameter you want to validate with the @URLValidator specified on mapping: " + mapping . getId ( ) ) ; } // prepare PathValidator PathValidator pathValidator = new PathValidator ( ) ; pathValidator . setIndex ( validationAnnotation . index ( ) ) ; pathValidator . setOnError ( validationAnnotation . onError ( ) ) ; pathValidator . setValidatorIds ( join ( validationAnnotation . validatorIds ( ) , " " ) ) ; // optional validator method if ( ! isBlank ( validationAnnotation . validator ( ) ) ) { pathValidator . setValidatorExpression ( new ConstantExpression ( validationAnnotation . validator ( ) ) ) ; } // add PathValidator to the mapping mapping . getPathValidators ( ) . add ( pathValidator ) ; } // return mapping id return mapping . getId ( ) . trim ( ) ; }
Process a single {@link URLMapping} annotation.

@param clazz The class that the annotation was found on
@param mappingAnnotation The annotation to process
@return The mapping ID of the mapping found
Process a single { @link URLMapping } annotation .