Examples of Validator


Examples of com.thaiopensource.validate.Validator

        PropertyMapBuilder mapBuilder = new PropertyMapBuilder();
        mapBuilder.put(ValidateProperty.XML_READER_CREATOR, xmlCreator);
        mapBuilder.put(ValidateProperty.ERROR_HANDLER, errorHandler);
        PropertyMap propertyMap = mapBuilder.toPropertyMap();

        Validator validator = getSchema().createValidator(propertyMap);

        Message in = exchange.getIn();
        SAXSource saxSource = in.getBody(SAXSource.class);
        if (saxSource == null) {
            Source source = ExchangeHelper.getMandatoryInBody(exchange, Source.class);
            saxSource = ExchangeHelper.convertToMandatoryType(exchange, SAXSource.class, source);
        }
        InputSource bodyInput = saxSource.getInputSource();

        // now lets parse the body using the validator
        XMLReader reader = xmlCreator.createXMLReader();
        reader.setContentHandler(validator.getContentHandler());
        reader.setDTDHandler(validator.getDTDHandler());
        reader.setErrorHandler(errorHandler);
        reader.parse(bodyInput);

        errorHandler.handleErrors(exchange, schema);
    }

Examples of com.vaadin.data.Validator

        final TextField tx = new TextField("Integer");
        mainWin.addComponent(tx);
        tx.setImmediate(true);
        CompositeValidator v = new CompositeValidator();
        v.addValidator(new IntegerValidator("{0} is not a number"));
        v.addValidator(new Validator() {

            private boolean isValid(Object value) {
                try {
                    int i = Integer.parseInt("" + value);
                    if (i < 0) {
                        return false;
                    }
                    return true;
                } catch (NumberFormatException e) {
                    return false;
                }
            }

            @Override
            public void validate(Object value) throws InvalidValueException {
                if (!isValid(value)) {
                    throw new InvalidValueException(value
                            + " is not a non-negative number");
                }
            }
        });
        CompositeValidator v2 = new CompositeValidator(CombinationMode.OR, null);
        v2.addValidator(v);
        v2.addValidator(new Validator() {

            @Override
            public void validate(Object value) throws InvalidValueException {
                if (!"".equals("" + value)) {
                    throw new InvalidValueException("Value is not empty string");

Examples of com.volantis.mcs.eclipse.validation.Validator

        ValidationMessageBuilder builder =
                new ValidationMessageBuilder(
                        ControlsMessages.getResourceBundle(),
                        messageKeyMappings,
                        null);
        Validator validator = new ColorValidator(NamedColor.getAllColors());
        return new IndependentValidator(validator, builder);
    }

Examples of com.volantis.mcs.model.validation.Validator

        String errorMessage = null;

        Object object = listBuilder.getObjectControl().getValue();
        if (object != null && object instanceof Validatable) {
            ModelFactory modelFactory = ModelFactory.getDefaultInstance();
            Validator validator = modelFactory.createValidator();

            // Validate the object being created
            validator.validate((Validatable) object);

            // Validate the already created selectors
            List selectors = listBuilder.getItems();
            Iterator it = selectors.iterator();
            while (it.hasNext() && validator.getDiagnostics().isEmpty()) {
                validator.validate((Validatable) it.next());
            }

            // Retrieve the first error message
            List diagnostics = validator.getDiagnostics();
            if (!diagnostics.isEmpty()) {
                Diagnostic firstDiagnostic = (Diagnostic) diagnostics.get(0);
                errorMessage = firstDiagnostic.getMessage().getMessage();
            }
        }

Examples of com.yammer.dropwizard.validation.Validator

    adminPort = openPorts[1];

    File temporaryConfigFile = createTemporaryConfigFile(port, adminPort);

    ConfigurationFactory<?> factory = ConfigurationFactory.forClass(
        service.getConfigurationClass(), new Validator(), service.getJacksonModules());
    configuration = (Configuration) factory.build(temporaryConfigFile);

    Environment environment = new Environment(service, configuration);
    service.initializeWithBundles(configuration, environment);

Examples of de.bastiankrol.startexplorer.util.Validator

  private LogFacility logFacility;

  void init()
  {
    this.logFacility = new LogFacility();
    this.validator = new Validator();
    this.customCommandResourceViewFactory = new CustomCommandResourceViewFactory();
    this.customCommandEditorFactory = new CustomCommandEditorFactory();
    this.variableManager = this.initVariableManager();
    this.sharedFileFinder = new SharedFileFinder();
    this.messageDialogHelper = new MessageDialogHelper();

Examples of de.mhus.lib.form2.validation.Validator

//    if (a == null) a = element.getLayoutFactory().getActivator();
    MActivator a = element.getLayoutFactory().getActivator();
   
    String[] va = string.split(",");
    for (String v : va) {
      Validator validator;
      try {
        validator = (Validator) a.getObject(Validator.class,v);
      } catch (Exception e) {
        e.printStackTrace();
        return false;
      }
      if (validator != null && !validator.validate(this,element,value))
        return false;
    }
    return true;
  }

Examples of dk.brics.xmlgraph.validator.Validator

      }
    }
    if (t == null)
      throw new XMLValidationException("No schema found for type " + type, origin);
    LocalValidationErrorHandler handler = new LocalValidationErrorHandler();
    new Validator(handler).validate(xg, t, i);
    if (!handler.errors.isEmpty()) {
      XMLValidationException ex = null;
      while (!handler.errors.isEmpty()) {
        XMLValidationException e = handler.errors.pop();
        e.setNext(ex);

Examples of etch.bindings.java.msg.Validator

    {
      Field key = readField( t );
      if (key == null)
        break;
     
      Validator v = t.getValidator( key );
      if (v != null)
      {
        sv.put( key, readValue( v ) );
      }
      else

Examples of fr.imag.adele.apam.maven.plugin.validation.Validator

             * Validate components, we validate first the most abstract components so that if there are cross-references
             * among components in the same build we detect errors soon and avoid cascaded errors
             */

            ValidationContext context  = new ValidationContext(new RepositoryChain(projectRepository,acr));
        Validator validator      = new Validator(projectRepository.getClasspath(),context);
       
            ErrorReport validatorResult = new ErrorReport(getLog());
           
      for (ComponentDeclaration component : components) {
        if (component instanceof SpecificationDeclaration) {
          validator.validate(component, validatorResult);
        }
      }

      for (ComponentDeclaration component : components) {
        if (component instanceof AtomicImplementationDeclaration) {
          validator.validate(component, validatorResult);
        }
      }

      for (ComponentDeclaration component : components) {
        if (component instanceof CompositeDeclaration) {
          validator.validate(component, validatorResult);
        }
      }

      for (ComponentDeclaration component : components) {
        if (component instanceof InstanceDeclaration) {
          validator.validate(component, validatorResult);
        }
      }

      /*
       * Abort if there are errors
TOP
Copyright © 2018 www.massapi.com. 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.