Package javax.validation

Examples of javax.validation.ValidationException


    try {
      value = m.invoke( annotation );
    }
    // should never happen
    catch ( IllegalAccessException e ) {
      throw new ValidationException( "Unable to retrieve annotation parameter value.", e );
    }
    catch ( InvocationTargetException e ) {
      throw new ValidationException( "Unable to retrieve annotation parameter value.", e );
    }
    return value;
  }
View Full Code Here


  public List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> getBuiltInConstraints(Class<? extends Annotation> annotationClass) {
    final List<Class<? extends ConstraintValidator<?, ?>>> builtInList = builtinConstraints.get( annotationClass );

    if ( builtInList == null || builtInList.size() == 0 ) {
      throw new ValidationException( "Unable to find constraints for  " + annotationClass );
    }

    List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> constraints =
        new ArrayList<Class<? extends ConstraintValidator<? extends Annotation, ?>>>( builtInList.size() );
    for ( Class<? extends ConstraintValidator<?, ?>> validatorClass : builtInList ) {
View Full Code Here

    Member member = ReflectionHelper.getMember(
        beanClass, property, elementType
    );

    if ( member == null ) {
      throw new ValidationException(
          "The class " + beanClass + " does not have a property '"
              + property + "' with access " + elementType
      );
    }
View Full Code Here

  public final <T> T unwrap(Class<T> type) {
    if ( type.isAssignableFrom( getClass() ) ) {
      return type.cast( this );
    }

    throw new ValidationException( "Type " + type + " not supported" );
  }
View Full Code Here

          pathToObject,
          metaConstraint.getElementType()
      );
    }
    catch ( RuntimeException e ) {
      throw new ValidationException( "Call to TraversableResolver.isReachable() threw an exception", e );
    }

    return isReachable;
  }
View Full Code Here

          pathToObject,
          type
      );
    }
    catch ( RuntimeException e ) {
      throw new ValidationException( "Call to TraversableResolver.isReachable() threw an exception", e );
    }

    try {
      isCascadable = validationContext.getTraversableResolver().isCascadable(
          valueContext.getCurrentBean(),
          path.getLeafNode(),
          validationContext.getRootBeanClass(),
          pathToObject,
          type
      );
    }
    catch ( RuntimeException e ) {
      throw new ValidationException( "Call to TraversableResolver.isCascadable() threw an exception", e );
    }

    return isReachable && isCascadable;
  }
View Full Code Here

      interpolatedValue = String.valueOf( validatedValue );
    }
    else {
      String format = expression.substring( separatorIndex + 1, expression.length() - 1 );
      if ( format.length() == 0 ) {
        throw new ValidationException( "Missing format string in template: " + expression );
      }
      try {
        interpolatedValue = String.format( locale, format, validatedValue );
      }
      catch ( IllegalFormatException e ) {
        throw new ValidationException( "Invalid format: " + e.getMessage(), e );
      }
    }
    return interpolatedValue;
  }
View Full Code Here

    return constraintDescriptor;
  }

  public final List<MessageAndPath> getMessageAndPathList() {
    if ( defaultDisabled && messageAndPaths.size() == 0 ) {
      throw new ValidationException(
          "At least one custom message must be created if the default error message gets disabled."
      );
    }

    List<MessageAndPath> returnedMessageAndPaths = new ArrayList<MessageAndPath>( messageAndPaths );
View Full Code Here

    Type constraintValidatorType = resolveTypes( resolvedTypes, validator );

    //we now have all bind from a type to its resolution at one level
    Type validatorType = ( (ParameterizedType) constraintValidatorType ).getActualTypeArguments()[VALIDATOR_TYPE_INDEX];
    if ( validatorType == null ) {
      throw new ValidationException( "null is an invalid type for a constraint validator." );
    }
    else if ( validatorType instanceof GenericArrayType ) {
      validatorType = TypeUtils.getArrayType( TypeUtils.getComponentType( validatorType ) );
    }
View Full Code Here

    Set<E> cv = new HashSet<E>();
    try {
      isValid = validator.isValid( valueContext.getCurrentValidatedValue(), constraintValidatorContext );
    }
    catch ( RuntimeException e ) {
      throw new ValidationException( "Unexpected exception during isValid call", e );
    }
    if ( !isValid ) {
      //We do not add them these violations yet, since we don't know how they are
      //going to influence the final boolean evaluation
      cv.addAll(
View Full Code Here

TOP

Related Classes of javax.validation.ValidationException

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.