/*
(non-Javadoc)

@see
com.fs.commons.desktop.validation.Validator#validate(com.fs.commons.desktop.
validation.Problems, java.lang.String, java.lang.Object)
507136
@Override
	public boolean validate(final Problems problems, final String compName, final Object model) {
		final boolean result = model != null && model.toString().length() > 0;
		if (!result) {
			final String message = ValidationBundle.getMessage(EmptyStringIllegalValidator.class, "MSG_MAY_NOT_BE_EMPTY", compName); // NOI18N
			problems.add(message);
		}
		return result;
	}
712568
@Override
	public List<ParsingError> doValidate() {

		// Component checks
		List<ParsingError> result = new ArrayList<> ();
		if( Utils.isEmptyOrWhitespaces( this.componentName ))
			result.add( error( ErrorCode.CMD_MISSING_COMPONENT_NAME ));

		else if( this.component == null )
			result.add( error( ErrorCode.CMD_INEXISTING_COMPONENT, component( this.componentName )));

		else if( ! this.component.getAncestors().isEmpty()) {

			Instance resolvedParentInstance;
			if( this.parentInstancePath == null )
				result.add( error( ErrorCode.CMD_MISSING_PARENT_INSTANCE ));
			else if(( resolvedParentInstance = this.context.resolveInstance( this.parentInstancePath )) == null )
				result.add( error( ErrorCode.CMD_NO_MATCHING_INSTANCE, instance( this.parentInstancePath )));
			else if( ! this.component.getAncestors().contains( resolvedParentInstance.getComponent()))
				result.add( error( ErrorCode.CMD_NOT_AN_ACCEPTABLE_PARENT, component( this.componentName )));

		} else if( this.parentInstancePath != null ) {
			result.add( error( ErrorCode.CMD_CANNOT_HAVE_ANY_PARENT, component( this.componentName )));
		}

		// Instance stuff
		if( Utils.isEmptyOrWhitespaces( this.instanceName ))
			result.add( error( ErrorCode.CMD_MISSING_INSTANCE_NAME ));
		else if( ! this.instanceName.matches( ParsingConstants.PATTERN_FLEX_ID ))
			result.add( error( ErrorCode.CMD_INVALID_INSTANCE_NAME, instance( this.instanceName )));

		String newInstancePath = (this.parentInstancePath == null ? "" : this.parentInstancePath) + "/" + this.instanceName;
		if( this.context.instancePathToComponentName.containsKey( newInstancePath ))
			result.add( error( ErrorCode.CMD_CONFLICTING_INSTANCE_NAME ));

		return result;
	}
821566
@Override
	public boolean validate(final Problems problems, final String compName, final String model) {
		final Matcher m = this.pattern.matcher(model);
		final boolean result = this.acceptPartialMatches ? m.lookingAt() : m.matches();
		if (!result) {
			String prb = this.message;
			prb = MessageFormat.format(prb, new Object[] { compName, model });
			problems.add(prb);
		}
		return result;
	}
1331611
@Override
	public boolean validate(final Problems problems, final String compName, final String text) {
		if (text.trim().length() == 0) {
			return true;
		}
		final String result = !Utilities.isJavaIdentifier(text)
				? ValidationBundle.getMessage(NotJavaIdentifierValidator.class, "ERR_JAVA_IDENTIFIER", text)
				: null; // NOI18N
		if (result != null) {
			problems.add(result);
		}
		return result == null;
	}
222724
private void validate() {
        if (host.isEmpty()) {
            throw new IllegalArgumentException("host cannot be null");
        }
        if (catalog == null) {
            throw new IllegalArgumentException("namespace cannot be null");
        }
        if (table == null) {
            throw new IllegalArgumentException("set cannot be null");
        }
        if (portList.isEmpty()) {
            if(port>0){
                port(port);
            }else{
                throw new IllegalArgumentException("port cannot be null");
            }

        }
        if (host.size() != portList.size()) {
            throw new IllegalArgumentException("Host and ports cardinality must be the same");
        }

    }
1058685
@Override
	public boolean validate(final Problems problems, final String compName, final String model) {
		if (model == null) {
			return false;
		}
		final boolean result = model.length() <= this.len;
		if (!result) {
			problems.add(ValidationBundle.getMessage(MaximumLength.class, "STRING_TOO_LONG", compName, model, "" + this.len)); // NOI18N
		}
		return result;
	}
839325
@Override
    public void validate(final Object targetObj, final SheetBindingErrors<?> errors, final Class<?>... groups) {
        
        ArgUtils.notNull(targetObj, "targetObj");
        ArgUtils.notNull(errors, "errors");
        
        processConstraintViolation(getTargetValidator().validate(targetObj, groups), errors);
        
    }
1012134
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString platform_validator = new MPSString();
		platform_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 64);
		platform_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		platform_validator.validate(operationType, platform, "\"platform\"");
		
		MPSInt max_number_of_ns_instances_validator = new MPSInt();
		max_number_of_ns_instances_validator.validate(operationType, max_number_of_ns_instances, "\"max_number_of_ns_instances\"");
		
		MPSString max_throughput_validator = new MPSString();
		max_throughput_validator.validate(operationType, max_throughput, "\"max_throughput\"");
		
		MPSString available_throughput_validator = new MPSString();
		available_throughput_validator.validate(operationType, available_throughput, "\"available_throughput\"");
		
		MPSInt max_number_of_br_instances_validator = new MPSInt();
		max_number_of_br_instances_validator.validate(operationType, max_number_of_br_instances, "\"max_number_of_br_instances\"");
		
		MPSInt available_number_of_ns_instances_validator = new MPSInt();
		available_number_of_ns_instances_validator.validate(operationType, available_number_of_ns_instances, "\"available_number_of_ns_instances\"");
		
		MPSInt max_number_of_instances_validator = new MPSInt();
		max_number_of_instances_validator.validate(operationType, max_number_of_instances, "\"max_number_of_instances\"");
		
		MPSInt available_number_of_instances_validator = new MPSInt();
		available_number_of_instances_validator.validate(operationType, available_number_of_instances, "\"available_number_of_instances\"");
		
		MPSBoolean sync_operation_validator = new MPSBoolean();
		sync_operation_validator.validate(operationType, sync_operation, "\"sync_operation\"");
		
		MPSString act_id_validator = new MPSString();
		act_id_validator.validate(operationType, act_id, "\"act_id\"");
		
	}
1270464
public void validate() {

		ErrorDetails details = null;
		if( this.fileName != null )
			details = ErrorDetails.file( this.fileName );

		if( this.failed ) {
			this.errors.add( new ModelError( ErrorCode.REC_TARGET_INVALID_FILE_OR_CONTENT, this.modelObject, details ));

		} else {
			String id = this.props.getProperty( Constants.TARGET_PROPERTY_ID );
			if( Utils.isEmptyOrWhitespaces( id ))
				this.errors.add( new ModelError( ErrorCode.REC_TARGET_NO_ID, this.modelObject, details ));

			String handler = this.props.getProperty( Constants.TARGET_PROPERTY_HANDLER );
			if( Utils.isEmptyOrWhitespaces( handler ))
				this.errors.add( new ModelError( ErrorCode.REC_TARGET_NO_HANDLER, this.modelObject, details ));

			String name = this.props.getProperty( Constants.TARGET_PROPERTY_NAME );
			if( Utils.isEmptyOrWhitespaces( name ))
				this.errors.add( new ModelError( ErrorCode.REC_TARGET_NO_NAME, this.modelObject, details ));
		}
	}
1101289
@Override
	public boolean validate(Object value) {
		if(constraints == null) {
			return false;
		}

		IConstraintChecker checker;
		for(BeanProperty constraint : constraints) {
			checker = checkers.get(constraint.getPropertyName());
			if(checker == null) {
				throw new RuntimeException("No checker found for constraint "
						+ "'" + constraint.getPropertyName() + "'"
				);
			}
			checker.check(value, constraint);
		}
		return true;
	}
774575
@Override
  public void validate() {
    try {
      IFD ifd = model.getFirstIFD();
      int n = 0;
      while (ifd != null) {
        validateIfd(ifd, n);
        ifd = ifd.getNextIFD();
        n++;
      }
    } catch (Exception e) {

    }
  }
321034
public void validate(Object o)
    {
        String s = String.valueOf(o);
        int i = s.indexOf(".");
        if (i == -1)
        {
            if ((m_integerDigits != -1 && s.length() > m_integerDigits))
            {            	
                String message = m_propertyMetadata.getMessageSourceAccessor().getMessage(m_message, new Object[]{ m_propertyMetadata.getLabelName(), m_integerDigits,m_fractionalDigits, String.valueOf(o) });
                throw new ValidationException(message);
            }
        }
        else
        {
            if (m_integerDigits != -1 && s.length() > m_integerDigits)
            {
                String message = m_propertyMetadata.getMessageSourceAccessor().getMessage(m_message, new Object[]{ m_propertyMetadata.getLabelName(), m_integerDigits,m_fractionalDigits,String.valueOf(o) });
                throw new ValidationException(message);
            }
            if (m_fractionalDigits != -1 && (s.length()-(i+1)) > m_fractionalDigits)
            {
                String message = m_propertyMetadata.getMessageSourceAccessor().getMessage(m_message, new Object[]{ m_propertyMetadata.getLabelName(),m_integerDigits,m_fractionalDigits, String.valueOf(o) });
                throw new ValidationException(message);
            }
        }
   }
68176
@Override
    public void validate() throws Exception {
        super.validate();
        this.parse();
        Assert.assertTrue(
                String.format(
                        "Lower bound %d should be less than upper bound %d",
                        lower,
                        upper),
                lower <= upper);
        Assert.assertFalse(
                "The range is empty",
                !this.includeLower
                    && !this.includeUpper
                    && (this.upper - this.lower) <= 1);
        Assert.assertFalse(
                "The range is empty",
                !(this.includeLower && this.includeUpper)
                    && (this.upper - this.lower) < 1);
    }
75754
@Override
	public boolean validate(final Problems problems, final String compName, final String model) {
		for (final char c : this.chars) {
			for (final char cc : model.toCharArray()) {
				if (cc == c) {
					problems.add(ValidationBundle.getMessage(DisallowCharactersValidator.class, "DISALLOWED_CHARS", asString(), compName)); // NOI18N
					return false;
				}
			}
		}
		return true;
	}
714982
public void setProblems(java.util.Collection<Problem> problems) {
        if (problems == null) {
            this.problems = null;
            return;
        }

        this.problems = new java.util.ArrayList<Problem>(problems);
    }
280814
@Override
    public void validate() {
        String target = getTargetName();
        //validate the parameters
        if (value() < 0) {
            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "timeout.parameter.invalid.value.CWMFT5011E", value(), target));
        }

    }
404430
@Override
	public List<ParsingError> doValidate() {

		List<ParsingError> result = new ArrayList<> ();
		if( Utils.isEmptyOrWhitespaces( this.targetId ))
			result.add( error( ErrorCode.CMD_INVALID_TARGET_ID, value( this.targetId )));

		Instance resolvedInstance;
		if(( resolvedInstance = this.context.resolveInstance( this.scopedInstancePath )) == null)
			result.add( error( ErrorCode.CMD_NO_MATCHING_INSTANCE, instance( this.scopedInstancePath )));
		else if( ! InstanceHelpers.isTarget( resolvedInstance ))
			result.add( error( ErrorCode.CMD_NOT_A_SCOPED_INSTANCE ));

		return result;
	}