Package org.ocpsoft.rewrite.param

Examples of org.ocpsoft.rewrite.param.Validator


      @Override
      @SuppressWarnings({ "rawtypes", "unchecked" })
      public boolean isValid(Rewrite event, EvaluationContext context, Object value)
      {

         Validator validator = null;

         // let one of the SPI implementations build the validator
         Iterator<ValidatorProvider> providers = ServiceLoader.load(ValidatorProvider.class).iterator();
         while (providers.hasNext()) {
            ValidatorProvider provider = providers.next();

            if (targetType != null) {
               validator = provider.getByTargetType(targetType);
            }
            else if (validatorType != null) {
               validator = provider.getByValidatorType(validatorType);
            }
            else {
               validator = provider.getByValidatorId(validatorId);
            }

            if (validator != null) {
               break;
            }

         }
         Assert.notNull(validator, "Got no validator from any ValidatorProvider for: " + this.toString());

         return validator.isValid(event, context, value);

      }
View Full Code Here


   @Test
   @SuppressWarnings("rawtypes")
   public void testEnqueueEvaluationProcessesConversionAndValidation() throws Exception
   {
      MockEvaluationContext context = new MockEvaluationContext();
      Validator validator = new Validator() {
         @Override
         public boolean isValid(Rewrite event, EvaluationContext context, Object value)
         {
            return "baxter III".equals(value);
         }
View Full Code Here

      Configuration config = ConfigurationBuilder
               .begin()
               .addRule()
               .when(Direction.isInbound().and(Path.matches("/v/{param}")))
               .perform(SendStatus.code(205))
               .where("param").bindsTo(Evaluation.property("param")).validatedBy(new Validator() {
                  @Override
                  public boolean isValid(final Rewrite event, final EvaluationContext context,
                           final Object value)
                  {
                     return "valid".equals(value);
View Full Code Here

TOP

Related Classes of org.ocpsoft.rewrite.param.Validator

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.