Check value constrains.

@param requiredType int
@param constraints - string constrains.
@param value - value to check.
@return result of check.
342238
private boolean checkValueConstraints(int requiredType, String[] constraints, Value value)
   {
      ValueConstraintsMatcher constrMatcher =
         new ValueConstraintsMatcher(constraints, locationFactory, dataManager, nodeTypeDataManager);

      try
      {
         return constrMatcher.match(((BaseValue)value).getInternalData(), requiredType);
      }
      catch (RepositoryException e1)
      {
         return false;
      }
   }
183983
public static void requireArgValid(@NotNull final String name, @NotNull final String value) throws ConstraintViolationException {
        // CHECKSTYLE:ON
        final String trimmedValue = value.trim();
        Contract.requireArgNotEmpty(name, trimmedValue);
    }
916916
public static Constraint required() {
		return new Constraint("required", simplePayload("required")) {
			public boolean isValid(Object actualValue) {
				return !(actualValue == null || StringUtils.isBlank(actualValue.toString()));
			}
		};
	}
417569
public static void requireArgValid(@NotNull final String name, @NotNull final String value) throws ConstraintViolationException {
        // CHECKSTYLE:ON

        final String trimmedLowerCaseValue = value.trim().toLowerCase();
        if (!isValid(trimmedLowerCaseValue)) {
            throw new ConstraintViolationException("The argument '" + name + "' is not valid: '" + trimmedLowerCaseValue + "'");
        }

    }
473744
public final void setConstraints(@NonNull final Constraint<Type>[] constraints) {
        Condition.INSTANCE.ensureNotNull(constraints, "The constraints may not be null");
        Condition.INSTANCE.ensureAtLeast(constraints.length, 1, "The constraints may not be empty");
        this.constraints = constraints;
    }
498358
def check_constraint(self, pkge=None, constr=None):
        
        if not pkge is None:
            return javabridge.call(
                self.jobject, "checkConstraint", "(Lweka/core/packageManagement/Package;)Z", pkge.jobject)
        if not constr is None:
            return javabridge.call(
                self.jobject, "checkConstraint", "(Lweka/core/packageManagement/PackageConstraint;)Z", pkge.jobject)
        raise Exception("Either package or package constraing must be provided!")
137368
public void checkConstraints(String checkLevel) throws ConstraintException
    {
        // check constraints now after all classes have been processed
        for (Iterator it = getClasses(); it.hasNext();)
        {
            ((ClassDescriptorDef)it.next()).checkConstraints(checkLevel);
        }
        // additional model constraints that either deal with bigger parts of the model or
        // can only be checked after the individual classes have been checked (e.g. specific
        // attributes have been ensured)
        new ModelConstraints().check(this, checkLevel);
    }
201329
public boolean addValidationConstraint(String type, String field, Constraint c) {
		if (!StringUtils.isBlank(type) && !StringUtils.isBlank(field) &&
				c != null && !c.getPayload().isEmpty() &&
				Constraint.isValidConstraintName(c.getName())) {
			Map<String, Map<String, Map<String, ?>>> fieldMap = getValidationConstraints().get(type);
			Map<String, Map<String, ?>> consMap;
			if (fieldMap != null) {
				consMap = fieldMap.get(field);
				if (consMap == null) {
					consMap = new LinkedHashMap<>();
				}
			} else {
				fieldMap = new LinkedHashMap<>();
				consMap = new LinkedHashMap<>();
			}
			consMap.put(c.getName(), c.getPayload());
			fieldMap.put(field, consMap);
			getValidationConstraints().put(type, fieldMap);
			return true;
		}
		return false;
	}
1258346
def validate(self, value):
        
        errors = []

        # Make sure the type validates first.
        valid = self._is_valid(value)
        if not valid:
            errors.append(self.fail(value))
            return errors

        # Then validate all the constraints second.
        for constraint in self._constraints_inst:
            error = constraint.is_valid(value)
            if error:
                errors.append(error)

        return errors
585761
public Constraint method(Object target, String methodName, String constraintType) {
        return new MethodInvokingConstraint(target, methodName, constraintType);
    }
52130
public static FormValidation validateRequired(String value) {
        if (Util.fixEmptyAndTrim(value) == null)
            return error(Messages.FormValidation_ValidateRequired());
        return ok();
    }
248026
public static <V> void validateConfiguredValueType(Class<V> valueType, V value) throws ClassCastException {
        if (Object.class != valueType) {
            // means that type checks is required
            if (!valueType.isAssignableFrom(value.getClass())) {
                throw new ClassCastException("Value '" + value + "' is not assignable to " + valueType);
            }
        }
    }
506377
def constraint_from_type(cls, value):
        
        if value is None:
            return None
        value_type = type(value)
        if value_type in (str, int, bool):
            return value_type
        raise ParameterError('Parameter type cannot be %s' % value_type)
951861
public DataColumnConstraints queryByUnique(String constraintName,
			DataColumnConstraintType constraintType, String value)
			throws SQLException {

		DataColumnConstraints constraint = null;

		QueryBuilder<DataColumnConstraints, Void> qb = queryBuilder();
		setUniqueWhere(qb.where(), constraintName, constraintType, value);
		List<DataColumnConstraints> constraints = qb.query();
		if (!constraints.isEmpty()) {

			if (constraints.size() > 1) {
				throw new GeoPackageException("More than one "
						+ DataColumnConstraints.class.getSimpleName()
						+ " was found for unique constraint. Name: "
						+ constraintName + ", Type: " + constraintType
						+ ", Value: " + value);
			}

			constraint = constraints.get(0);
		}

		return constraint;
	}
1319851
public static <FACETEDTYPE extends Faceted<?>, FACETTYPE extends Facet<FACETEDTYPE>> boolean isConstraintSatisfied(
            Faceted<FACETTYPE> faceted, Set<Class<FACETTYPE>> requiredFacets)
   {
      boolean constraintsSatisfied = true;
      for (Class<FACETTYPE> type : requiredFacets)
      {
         if (!faceted.hasFacet(type))
         {
            constraintsSatisfied = false;
            break;
         }
      }
      return constraintsSatisfied;
   }
673261
public void addConstraint( final FieldConstraint constraint ) {
        if ( constraintList == null ) {
            constraintList = new CompositeFieldConstraint();
        }
        this.constraintList.addConstraint( constraint );
    }
101717
public static boolean isConstraintSatisfied(Project project,
            Set<Class<ProjectFacet>> requiredFacets)
   {
      boolean constraintsSatisfied = true;
      Iterable<StackFacet> stackFacets = project.getFacets(StackFacet.class);
      OUTER: for (StackFacet stackFacet : stackFacets)
      {
         for (Class<ProjectFacet> type : requiredFacets)
         {
            if (!stackFacet.getStack().supports(type))
            {
               constraintsSatisfied = false;
               break OUTER;
            }
         }
      }
      return constraintsSatisfied;
   }