Only accepts if method isn't parameterless and have at least one constraint.
519812
private boolean hasConstraints(ControllerMethod controllerMethod) {
		Method method = controllerMethod.getMethod();
		if (method.getParameterTypes().length == 0) {
			logger.debug("method {} has no parameters, skipping", controllerMethod);
			return false;
		}
		BeanDescriptor bean = bvalidator.getConstraintsForClass(controllerMethod.getController().getType());
		if(bean == null) {
			return false;
		}
		MethodDescriptor descriptor = bean.getConstraintsForMethod(method.getName(), method.getParameterTypes());
		return descriptor != null && descriptor.hasConstrainedParameters();
	}
513082
public EasyRandomParameters excludeType(Predicate<Class<?>> predicate) {
        Objects.requireNonNull(predicate, "Predicate must not be null");
        typeExclusionPredicates.add(predicate);
        exclusionRandomizerRegistry.addTypePredicate(predicate);
        return this;
    }
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;
   }
629363
@SuppressWarnings("fallthrough")
    static Map<Method, String> validate(Object subscriber, List<Method> subscriberMethods) {
        Map<Method, String> errors = new HashMap<Method, String>(subscriberMethods.size());
        for (Method method : subscriberMethods) {
            Subscribe subscribeAnnotation = method.getAnnotation(Subscribe.class);
            if (null != subscribeAnnotation) {
                issueWarningsIfPresent(subscribeAnnotation, subscriber, method);
                Class<?>[] parameterTypes = method.getParameterTypes();
                if (parameterTypes.length != 1) {
                    errors.put(method, String.format(
                            "Subscriber: %s's Method: %s is annotated as a subscriber but defines more that one arguments.",
                            subscriber.getClass(), method.toGenericString()));
                } else if (parameterTypes[0].equals(Object.class)
                           && !subscriber.getClass().equals(CatchAllSubscriber.class)
                           && !DynamicSubscriber.class.isAssignableFrom(subscriber.getClass())) {
                    errors.put(method, String.format(
                            "Subscriber: %s's Method: %s is a subscriber for java.lang.Object, that is too broad an interest.",
                            subscriber.getClass(), method.toGenericString()));
                } else if (DynamicSubscriber.class.isAssignableFrom(subscriber.getClass())
                           && !parameterTypes[0].equals(Object.class)) {
                    Class<?> targetedEventType = ((DynamicSubscriber) subscriber).getEventType();
                    if (!parameterTypes[0].isAssignableFrom(targetedEventType)) {
                        errors.put(method, String.format(
                                "Dynamic subscriber: %s's Method: %s's argument is not compatible with the interested event type %s.",
                                subscriber.getClass(), method.toGenericString(), targetedEventType.getName()));
                    }
                } else if (subscribeAnnotation.batchingStrategy() != Subscribe.BatchingStrategy.None) {
                    if (!(Iterable.class.isAssignableFrom(parameterTypes[0]))) {
                        errors.put(method, String.format(
                                "Subscriber: %s's Method: %s is annotated with batching strategy: %s but does not accept an Iterable argument.",
                                subscriber.getClass(), method.toGenericString(),
                                subscribeAnnotation.batchingStrategy()));
                    } else {
                        Type[] genericParameterTypes = method.getGenericParameterTypes();
                        if (!(genericParameterTypes[0] instanceof ParameterizedType)) {
                            errors.put(method, String.format(
                                    "Subscriber: %s's Method: %s is a subscriber for java.lang.Object, that is too broad an interest.",
                                    subscriber.getClass(), method.toGenericString()));
                        }
                    }

                    switch (subscribeAnnotation.batchingStrategy()) {
                        case SizeOrAge:
                            if (subscribeAnnotation.batchSize() <= 1) {
                                errors.put(method, String.format(
                                        "Subscriber: %s's Method: %s is annotated with batching strategy: %s but does define a batch size.",
                                        subscriber.getClass(), method.toGenericString(),
                                        subscribeAnnotation.batchingStrategy()));
                            }
                        case Age:
                            if (subscribeAnnotation.batchAge() <= 0) {
                                errors.put(method, String.format(
                                        "Subscriber: %s's Method: %s is annotated with batching strategy: %s but does define a batch age.",
                                        subscriber.getClass(), method.toGenericString(),
                                        subscribeAnnotation.batchingStrategy()));
                            }
                            break;
                    }
                }
            }
        }
        return errors;
    }
240251
public static void notNegative(Long value) {
		if(!validation) return;
		notNull(value);
		if(value < 0)
			throw new ParameterException(ErrorCode.NEGATIVE);
	}
439028
private static boolean hasEmptyThrowsClause(Method method) {
        for (Class<?> klass : method.getExceptionTypes()) {
            // Per CTS, callback methods can declare unchecked exceptions on the
            // throws clause.
            if (!RuntimeException.class.isAssignableFrom(klass) &&
                !Error.class.isAssignableFrom(klass)) {
                return false;
            }
        }

        return true;
    }
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!")
715575
public Constraint not(Constraint constraint) {
        if (!(constraint instanceof Not))
            return new Not(constraint);

        return ((Not)constraint).getConstraint();
    }
81919
public static void requireArgNotEmpty(@NotNull final String name, final String value) throws ConstraintViolationException {
        // CHECKSTYLE:ON
        requireArgNotNull(name, value);
        if (value.length() < 1) {
            throw new ConstraintViolationException("The argument '" + name + "' cannot be empty");
        }
    }
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;
	}
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;
      }
   }
1288899
@SuppressWarnings({"ThrowableInstanceNeverThrown"})
    public static void validateIsStatic(Method method, List<Throwable> errors)
    {
        if (!Modifier.isStatic(method.getModifiers()))
        {
            errors.add(new Exception("Method " + method.getName() + "() should be static"));
        }
        if (!Modifier.isPublic(method.getDeclaringClass().getModifiers()))
        {
            errors.add(new Exception("Class " + method.getDeclaringClass().getName() + " should be public"));
        }
    }
309139
public boolean isMethodAllowed(String method) {

		return HttpMethod.isValidMethod(method) && (allowedMethods.isEmpty() || allowedMethods.contains(method));
	}
1106639
private boolean isConstrainedByInterface(FQMethod fqMethod) {

        try {
            JavaClass fqCls = Repository.lookupClass(fqMethod.getClassName());
            if (fqCls.isInterface()) {
                return true;
            }

            for (JavaClass inf : fqCls.getAllInterfaces()) {
                for (Method infMethod : inf.getMethods()) {
                    if (infMethod.getName().equals(fqMethod.getMethodName())) {
                        String infMethodSig = infMethod.getSignature();
                        String fqMethodSig = fqMethod.getSignature();
                        if (infMethodSig.equals(fqMethodSig)) {
                            return true;
                        }

                        List<String> infTypes = SignatureUtils.getParameterSignatures(infMethodSig);
                        List<String> fqTypes = SignatureUtils.getParameterSignatures(fqMethodSig);

                        if (infTypes.size() == fqTypes.size()) {
                            boolean matches = true;
                            for (int i = 0; i < infTypes.size(); i++) {
                                String infParmType = infTypes.get(i);
                                String fqParmType = fqTypes.get(i);
                                if (infParmType.equals(fqParmType)) {
                                    if ((infParmType.charAt(0) != 'L') || (fqParmType.charAt(0) != 'L')) {
                                        matches = false;
                                        break;
                                    }

                                    JavaClass infParmClass = Repository.lookupClass(SignatureUtils.stripSignature(infParmType));
                                    JavaClass fqParmClass = Repository.lookupClass(SignatureUtils.stripSignature(fqParmType));
                                    if (!fqParmClass.instanceOf(infParmClass)) {
                                        matches = false;
                                        break;
                                    }
                                }
                            }

                            if (matches) {
                                return true;
                            }
                        }
                    }
                }
            }

            return false;
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
            return true;
        }
    }
931406
private static void checkTypeAdapterForParam( SQLiteModelMethod method,
			String methodParamName, Class<? extends Annotation> annotation) {
		
		TypeName paramType=method.findParameterType(methodParamName);
		if (method.isSpreadParameter(methodParamName)) {
			if (paramType instanceof ArrayTypeName) {				
				paramType = ((ArrayTypeName) paramType).componentType;
			} else if (paramType instanceof ParameterizedTypeName) {				
				paramType = ((ParameterizedTypeName) paramType).typeArguments.get(0);
			} 
		}
		
		TypeName adapterType = method.getAdapterForParam(methodParamName);
		
		
		TypeName sourceType = TypeUtility.typeName(TypeAdapterHelper.detectSourceType(method, adapterType));
		TypeName uboxSourceType=sourceType;
		
		if (TypeUtility.isTypeWrappedPrimitive(sourceType)) {
			uboxSourceType=sourceType.unbox();
		}
		
		boolean expr=uboxSourceType.toString().equals(paramType.toString()) || sourceType.toString().equals(paramType.toString());
		
		
		AssertKripton.fail(!expr,
				"In DAO '%s', method '%s' has parameter '%s' uses @%s that manages type '%s' instead of '%s'", method.getParent().getName(), method.getName(),
				methodParamName, annotation.getSimpleName(),sourceType, paramType);

	}
561072
public static void validateMethodOrThrow(Method method) {
    Class<?> returnType = method.getReturnType();
    if (returnType.equals(Void.TYPE)) {
      return;
    } else if (!Publisher.class.isAssignableFrom(returnType)) {
      throw new UnsupportedOperationException("Service method return type can be Publisher only");
    }
    if (method.getParameterCount() > 1) {
      throw new UnsupportedOperationException("Service method can accept 0 or 1 parameters only");
    }
  }
484370
public void addAllowedMethod(String method) {

		Constraint.ensureNotEmpty(method, String.format("Invalid method '%s'", method));
		Constraint.ensureTrue(HttpMethod.isValidMethod(method), String.format("Invalid method '%s'", method));
		allowedMethods.add(method.toUpperCase());
	}