config-prettyfaces/src/main/java/com/ocpsoft/pretty/faces/config/annotation/PrettyAnnotationHandler.java
public void build(PrettyConfigBuilder builder)
   {

      // process all actions found
      for (ActionSpec actionSpec : urlActions)
      {

         // create an action for each referenced mapping
         for (String mappingId : actionSpec.getMappingIds())
         {

            // Get the mapping references by the action
            UrlMapping mapping = urlMappings.get(mappingId);

            /*
             * Fail for unresolved mappings. This may happen when the user places
             * invalid mapping IDs in the mappingId attribute of
             * 
             * @URLAction or @URLQueryParameter
             */
            if (mapping == null)
            {
               throw new IllegalArgumentException("Unable to find the mapping '" + mappingId
                        + "' referenced at method '" + actionSpec.getMethod().getName() + "' in class '"
                        + actionSpec.getMethod().getDeclaringClass().getName() + "'.");
            }

            // build UrlMapping
            UrlAction urlAction = new UrlAction();
            urlAction.setPhaseId(actionSpec.getPhaseId());
            urlAction.setOnPostback(actionSpec.isOnPostback());
            urlAction.setInheritable(actionSpec.isInheritable());

            // try to get bean name
            Class<?> clazz = actionSpec.getMethod().getDeclaringClass();

            // build expression
            PrettyExpression expression = buildPrettyExpression(clazz, actionSpec.getMethod().getName());
            urlAction.setAction(expression);

            // trace
            if (log.isTraceEnabled())
            {
               log.trace("Adding action expression '" + urlAction.getAction() + "' to mapping: " + mapping.getId());
            }

            // register this action
            mapping.addAction(urlAction);

         }
      }

      for (QueryParamSpec queryParamSpec : queryParamList)
      {

         // create a query param for each referenced mapping
         for (String mappingId : queryParamSpec.getMappingIds())
         {

            // Get the mapping references by the query param
            UrlMapping mapping = urlMappings.get(mappingId);

            // fail for unresolved mappings
            if (mapping == null)
            {
               throw new IllegalArgumentException("Unable to find the mapping '" + mappingId
                        + "' referenced at field '" + queryParamSpec.getFieldName() + "' in class '"
                        + queryParamSpec.getOwnerClass().getName() + "'.");
            }

            // build UrlMapping
            QueryParameter queryParam = new QueryParameter();
            queryParam.setName(queryParamSpec.getName());
            queryParam.setOnError(queryParamSpec.getOnError());
            queryParam.setValidatorIds(join(queryParamSpec.getValidatorIds(), " "));
            queryParam.setOnPostback(queryParamSpec.isOnPostback());

            // optional validator method
            if (!isBlank(queryParamSpec.getValidator()))
            {
               queryParam.setValidatorExpression(new ConstantExpression(queryParamSpec.getValidator()));
            }

            // try to get bean name
            Class<?> clazz = queryParamSpec.getOwnerClass();

            // build expression
            PrettyExpression expression = buildPrettyExpression(clazz, queryParamSpec.getFieldName());
            queryParam.setExpression(expression);

            // trace
            if (log.isTraceEnabled())
            {
               log.trace("Registered query-param '" + queryParam.getName() + "' to '" + expression + "' in mapping: "
                        + mapping.getId());
            }

            // register this action
            mapping.addQueryParam(queryParam);

         }

      }

      // finally register all mappings
      for (UrlMapping mapping : urlMappings.values())
      {
         builder.addMapping(mapping);
      }
   }
public void build(PrettyConfigBuilder builder)
   {

      // process all actions found
      for (ActionSpec actionSpec : urlActions)
      {

         // create an action for each referenced mapping
         for (String mappingId : actionSpec.getMappingIds())
         {

            // Get the mapping references by the action
            UrlMapping mapping = urlMappings.get(mappingId);

            /*
             * Fail for unresolved mappings. This may happen when the user places
             * invalid mapping IDs in the mappingId attribute of
             * 
             * @URLAction or @URLQueryParameter
             */
            if (mapping == null)
            {
               throw new IllegalArgumentException("Unable to find the mapping '" + mappingId
                        + "' referenced at method '" + actionSpec.getMethod().getName() + "' in class '"
                        + actionSpec.getMethod().getDeclaringClass().getName() + "'.");
            }

            // build UrlMapping
            UrlAction urlAction = new UrlAction();
            urlAction.setPhaseId(actionSpec.getPhaseId());
            urlAction.setOnPostback(actionSpec.isOnPostback());
            urlAction.setInheritable(actionSpec.isInheritable());

            // try to get bean name
            Class<?> clazz = actionSpec.getMethod().getDeclaringClass();

            // build expression
            PrettyExpression expression = buildPrettyExpression(clazz, actionSpec.getMethod().getName());
            urlAction.setAction(expression);

            // trace
            if (log.isTraceEnabled())
            {
               log.trace("Adding action expression '" + urlAction.getAction() + "' to mapping: " + mapping.getId());
            }

            // register this action
            mapping.addAction(urlAction);

         }
      }

      for (QueryParamSpec queryParamSpec : queryParamList)
      {

         // create a query param for each referenced mapping
         for (String mappingId : queryParamSpec.getMappingIds())
         {

            // Get the mapping references by the query param
            UrlMapping mapping = urlMappings.get(mappingId);

            // fail for unresolved mappings
            if (mapping == null)
            {
               throw new IllegalArgumentException("Unable to find the mapping '" + mappingId
                        + "' referenced at field '" + queryParamSpec.getFieldName() + "' in class '"
                        + queryParamSpec.getOwnerClass().getName() + "'.");
            }

            // build UrlMapping
            QueryParameter queryParam = new QueryParameter();
            queryParam.setName(queryParamSpec.getName());
            queryParam.setOnError(queryParamSpec.getOnError());
            queryParam.setValidatorIds(join(queryParamSpec.getValidatorIds(), " "));
            queryParam.setOnPostback(queryParamSpec.isOnPostback());

            // optional validator method
            if (!isBlank(queryParamSpec.getValidator()))
            {
               queryParam.setValidatorExpression(new ConstantExpression(queryParamSpec.getValidator()));
            }

            // try to get bean name
            Class<?> clazz = queryParamSpec.getOwnerClass();

            // build expression
            PrettyExpression expression = buildPrettyExpression(clazz, queryParamSpec.getFieldName());
            queryParam.setExpression(expression);

            // trace
            if (log.isTraceEnabled())
            {
               log.trace("Registered query-param '" + queryParam.getName() + "' to '" + expression + "' in mapping: "
                        + mapping.getId());
            }

            // register this action
            mapping.addQueryParam(queryParam);

         }

      }

      // finally register all mappings
      for (UrlMapping mapping : urlMappings.values())
      {
         builder.addMapping(mapping);
      }
   }
public void build ( PrettyConfigBuilder builder ) { // process all actions found for ( ActionSpec actionSpec : urlActions ) { // create an action for each referenced mapping for ( String mappingId : actionSpec . getMappingIds ( ) ) { // Get the mapping references by the action UrlMapping mapping = urlMappings . get ( mappingId ) ; /*
             * Fail for unresolved mappings. This may happen when the user places
             * invalid mapping IDs in the mappingId attribute of
             * 
             * @URLAction or @URLQueryParameter
             */ if ( mapping == null ) { throw new IllegalArgumentException ( "Unable to find the mapping '" + mappingId + "' referenced at method '" + actionSpec . getMethod ( ) . getName ( ) + "' in class '" + actionSpec . getMethod ( ) . getDeclaringClass ( ) . getName ( ) + "'." ) ; } // build UrlMapping UrlAction urlAction = new UrlAction ( ) ; urlAction . setPhaseId ( actionSpec . getPhaseId ( ) ) ; urlAction . setOnPostback ( actionSpec . isOnPostback ( ) ) ; urlAction . setInheritable ( actionSpec . isInheritable ( ) ) ; // try to get bean name Class < ? > clazz = actionSpec . getMethod ( ) . getDeclaringClass ( ) ; // build expression PrettyExpression expression = buildPrettyExpression ( clazz , actionSpec . getMethod ( ) . getName ( ) ) ; urlAction . setAction ( expression ) ; // trace if ( log . isTraceEnabled ( ) ) { log . trace ( "Adding action expression '" + urlAction . getAction ( ) + "' to mapping: " + mapping . getId ( ) ) ; } // register this action mapping . addAction ( urlAction ) ; } } for ( QueryParamSpec queryParamSpec : queryParamList ) { // create a query param for each referenced mapping for ( String mappingId : queryParamSpec . getMappingIds ( ) ) { // Get the mapping references by the query param UrlMapping mapping = urlMappings . get ( mappingId ) ; // fail for unresolved mappings if ( mapping == null ) { throw new IllegalArgumentException ( "Unable to find the mapping '" + mappingId + "' referenced at field '" + queryParamSpec . getFieldName ( ) + "' in class '" + queryParamSpec . getOwnerClass ( ) . getName ( ) + "'." ) ; } // build UrlMapping QueryParameter queryParam = new QueryParameter ( ) ; queryParam . setName ( queryParamSpec . getName ( ) ) ; queryParam . setOnError ( queryParamSpec . getOnError ( ) ) ; queryParam . setValidatorIds ( join ( queryParamSpec . getValidatorIds ( ) , " " ) ) ; queryParam . setOnPostback ( queryParamSpec . isOnPostback ( ) ) ; // optional validator method if ( ! isBlank ( queryParamSpec . getValidator ( ) ) ) { queryParam . setValidatorExpression ( new ConstantExpression ( queryParamSpec . getValidator ( ) ) ) ; } // try to get bean name Class < ? > clazz = queryParamSpec . getOwnerClass ( ) ; // build expression PrettyExpression expression = buildPrettyExpression ( clazz , queryParamSpec . getFieldName ( ) ) ; queryParam . setExpression ( expression ) ; // trace if ( log . isTraceEnabled ( ) ) { log . trace ( "Registered query-param '" + queryParam . getName ( ) + "' to '" + expression + "' in mapping: " + mapping . getId ( ) ) ; } // register this action mapping . addQueryParam ( queryParam ) ; } } // finally register all mappings for ( UrlMapping mapping : urlMappings . values ( ) ) { builder . addMapping ( mapping ) ; } }
This methods adds all mappings found to the supplied {@link PrettyConfigBuilder}. It should be called after all
classes has been scanned via {@link #processClass(Class)}.

@param builder The builder to add the mappings to
This methods adds all mappings found to the supplied { @link PrettyConfigBuilder } . It should be called after all classes has been scanned via { @link #processClass ( Class ) } .