Package org.ocpsoft.rewrite.faces.config

Examples of org.ocpsoft.rewrite.faces.config.PhaseBinding$PhaseBindingOperation


         if (parameter != null) {

            Binding binding = (Binding) context.get(Binding.class);
            if (binding != null)
            {
               PhaseBinding phaseBinding = PhaseBinding.to(binding);

               Converter<?> converter = parameter.getConverter();
               if (converter != null)
               {
                  if (converter instanceof DeferredConverter)
                  {
                     converter = ((DeferredConverter) converter).getDeferred();
                  }
                  phaseBinding.convertedBy(converter);
                  if (parameter instanceof ParameterConfiguration)
                     ((ParameterConfiguration<?>) parameter).convertedBy(new DeferredConverter(converter));
                  else
                     throw new RewriteException("Cannot specify @" + Deferred.class.getSimpleName() + " to ["
                              + field + "] of class [" + field.getDeclaringClass() + "] because the parameter ["
                              + parameter.getName() + "] is not writable.");
               }

               Validator<?> validator = parameter.getValidator();
               if (validator != null)
               {
                  if (validator instanceof DeferredValidator)
                  {
                     validator = ((DeferredValidator) validator).getDeferred();
                  }
                  phaseBinding.validatedBy(validator);

                  if (parameter instanceof ParameterConfiguration)
                     ((ParameterConfiguration<?>) parameter).validatedBy(new DeferredValidator(validator));
                  else
                     throw new RewriteException("Cannot specify @" + Deferred.class.getSimpleName() + " to ["
                              + field + "] of class [" + field.getDeclaringClass() + "] because the parameter ["
                              + parameter.getName() + "] is not writable.");
               }

               // configure the target phase
               if (annotation.before() == Phase.NONE && annotation.after() == Phase.NONE) {
                  phaseBinding.after(PhaseId.RESTORE_VIEW);
               }
               else if (annotation.before() != Phase.NONE && annotation.after() == Phase.NONE) {
                  phaseBinding.before(annotation.before().getPhaseId());
               }
               else if (annotation.before() == Phase.NONE && annotation.after() != Phase.NONE) {
                  phaseBinding.after(annotation.after().getPhaseId());
               }
               else {
                  throw new IllegalStateException("Error processing field " + field
                           + ": You cannot use after() and before() at the same time.");
               }
View Full Code Here

TOP

Related Classes of org.ocpsoft.rewrite.faces.config.PhaseBinding$PhaseBindingOperation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.