class ConstraintHelper {

	public boolean isConstraintAnnotation(Annotation annotation) {

		Constraint constraint = annotation.annotationType()
				.getAnnotation( Constraint.class );
		if ( constraint == null ) {
			return false;
		}

		try {
			ReflectionHelper.getAnnotationParameter( annotation, "message", String.class );
		}
		catch ( Exception e ) {
			String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
					"not contain a message parameter. Annotation is getting ignored.";
			log.warn( msg );
			return false;
		}

		try {
			ReflectionHelper.getAnnotationParameter( annotation, "groups", Class[].class );
		}
		catch ( Exception e ) {
			String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
					"not contain a groups parameter. Annotation is getting ignored.";
			log.warn( msg );
			return false;
		}

		Method[] methods = annotation.getClass().getMethods();
		for ( Method m : methods ) {
			if ( m.getName().startsWith( "valid" ) ) {
				String msg = "Parameters starting with 'valid' are not allowed in a constraint.";
				log.warn( msg );
				return false;
			}
		}
		return true;
	}

	public  ConstraintHelper();

}