Package javax.validation

Examples of javax.validation.Constraint


        AccessStrategy access, AppendValidation validations) throws InvocationTargetException, IllegalAccessException {

        if (annotation instanceof Valid || annotation instanceof Validate) {
            desc.setCascaded(true);
        } else {
            Constraint vcAnno = annotation.annotationType().getAnnotation(Constraint.class);
            if (vcAnno != null) {
                annotationProcessor.processAnnotation(annotation, null,
                    ClassUtils.primitiveToWrapper((Class<?>) access.getJavaType()), access, validations);
            } else {
                /**
 
View Full Code Here


        /**
         * An annotation is considered a constraint definition if its retention
         * policy contains RUNTIME and if the annotation itself is annotated
         * with javax.validation.Constraint.
         */
        Constraint vcAnno = annotation.annotationType().getAnnotation(Constraint.class);
        if (vcAnno != null) {
            ConstraintDefinitionValidator.validateConstraintDefinition(annotation);
            Class<? extends ConstraintValidator<A, ?>>[] validatorClasses;
            validatorClasses = findConstraintValidatorClasses(annotation, vcAnno);
            return applyConstraint(annotation, validatorClasses, prop, owner, access, appender);
View Full Code Here

            }
        }

        private <A extends Annotation> void processConstraint(final A annotation, final InvocableElementDescriptor desc,
                                                              final AccessStrategy access, final AppendValidation validations) throws IllegalAccessException, InvocationTargetException {
            Constraint vcAnno = annotation.annotationType().getAnnotation(Constraint.class);
            if (vcAnno != null) {
                annotationProcessor.processAnnotation(annotation, null, ClassUtils.primitiveToWrapper((Class<?>) access.getJavaType()), access, validations, true);
            } else {
                /**
                 * Multi-valued constraints
View Full Code Here

   *
   * @return <code>true</code> if the annotation fulfills the above condtions, <code>false</code> otherwise.
   */
  public boolean isConstraintAnnotation(Annotation annotation) {

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

View Full Code Here

   * @param annotationType The annotation type to test.
   *
   * @return <code>true</code> if the annotation fulfills the above condtions, <code>false</code> otherwise.
   */
  public boolean isConstraintAnnotation(Class<? extends Annotation> annotationType) {
    Constraint constraint = annotationType.getAnnotation( Constraint.class );
    if ( constraint == null ) {
      return false;
    }

    assertMessageParameterExists( annotationType );
View Full Code Here

   * @param annotationType The annotation type to test.
   *
   * @return <code>true</code> if the annotation fulfills the above condtions, <code>false</code> otherwise.
   */
  public boolean isConstraintAnnotation(Class<? extends Annotation> annotationType) {
    Constraint constraint = annotationType.getAnnotation( Constraint.class );
    if ( constraint == null ) {
      return false;
    }

    assertMessageParameterExists( annotationType );
View Full Code Here

        /**
         * An annotation is considered a constraint definition if its retention
         * policy contains RUNTIME and if the annotation itself is annotated
         * with javax.validation.Constraint.
         */
        Constraint vcAnno = annotation.annotationType().getAnnotation(Constraint.class);
        if (vcAnno != null) {
            Class<? extends ConstraintValidator<A, ?>>[] validatorClasses;
            validatorClasses = findConstraintValidatorClasses(annotation, vcAnno);
            return applyConstraint(annotation, validatorClasses, prop, owner, access, appender);
        }
View Full Code Here

        if (validationAppliesTo != null && !ConstraintTarget.IMPLICIT.equals(validationAppliesTo.getDefaultValue())) {
            throw new ConstraintDefinitionException("validationAppliesTo default value should be IMPLICIT");
        }

        // valid validationAppliesTo
        final Constraint annotation = annotationType.getAnnotation(Constraint.class);
        if (annotation == null) {
            return;
        }

        final Pair validationTarget = computeValidationTarget(annotation.validatedBy());
        for (final Annotation a : annotationType.getAnnotations()) {
            final Class<? extends Annotation> aClass = a.annotationType();
            if (aClass.getName().startsWith("java.lang.annotation.")) {
                continue;
            }

            final Constraint inheritedConstraint = aClass.getAnnotation(Constraint.class);
            if (inheritedConstraint != null && !aClass.getName().startsWith("javax.validation.constraints.")) {
                final Pair validationTargetInherited = computeValidationTarget(inheritedConstraint.validatedBy());
                if ((validationTarget.a > 0 && validationTargetInherited.b > 0 && validationTarget.b == 0)
                        || (validationTarget.b > 0 && validationTargetInherited.a > 0 && validationTarget.a == 0)) {
                    throw new ConstraintDefinitionException("Parent and child constraint have different targets");
                }
            }
View Full Code Here

   *
   * @return <code>true</code> if the annotation fulfills the above condtions, <code>false</code> otherwise.
   */
  public boolean isConstraintAnnotation(Annotation annotation) {

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

View Full Code Here

      throws InvocationTargetException, IllegalAccessException {

    if (annotation instanceof Valid) {
      desc.setCascaded(true);
    } else {
      Constraint vcAnno = annotation.annotationType().getAnnotation(Constraint.class);
      if (vcAnno != null) {
        Class<? extends ConstraintValidator<A, ?>>[] validatorClasses;
        validatorClasses = findConstraintValidatorClasses(annotation, vcAnno);
        applyConstraint(annotation, validatorClasses, null,
            ClassUtils.primitiveToWrapper((Class<?>) access.getJavaType()), access, validations);
View Full Code Here

TOP

Related Classes of javax.validation.Constraint

Copyright © 2018 www.massapicom. 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.