Package javax.validation

Examples of javax.validation.ValidationException


    return constraintDescriptor;
  }

  public 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


  public ConstraintValidatorFactory getConstraintValidatorFactory() {
    return constraintValidatorFactory;
  }

  public <T> T unwrap(Class<T> type) {
    throw new ValidationException( "Type " + type + " not supported" );
  }
View Full Code Here

  public BeanDescriptor getConstraintsForClass(Class<?> clazz) {
    return getBeanMetaData( clazz ).getBeanDescriptor();
  }

  public <T> T unwrap(Class<T> type) {
    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 = globalContext.getTraversableResolver().isCascadable(
          localContext.getCurrentBean(),
          localContext.getPropertyPath().getLeafNode(),
          globalContext.getRootBeanClass(),
          pathToObject,
          type
      );
    }
    catch ( RuntimeException e ) {
      throw new ValidationException( "Call to TraversableResolver.isCascadable() threw an exception", e );
    }

    return isReachable && isCascadable;
  }
View Full Code Here

      if ( o.getClass().getName().equals( type.getName() ) ) {
        return ( T ) o;
      }
      else {
        String msg = "Wrong parameter type. Expected: " + type.getName() + " Actual: " + o.getClass().getName();
        throw new ValidationException( msg );
      }
    }
    catch ( NoSuchMethodException e ) {
      String msg = "The specified annotation defines no parameter '" + parameterName + "'.";
      throw new ValidationException( msg, e );
    }
    catch ( IllegalAccessException e ) {
      String msg = "Unable to get '" + parameterName + "' from " + annotation.getClass().getName();
      throw new ValidationException( msg, e );
    }
    catch ( InvocationTargetException e ) {
      String msg = "Unable to get '" + parameterName + "' from " + annotation.getClass().getName();
      throw new ValidationException( msg, e );
    }
  }
View Full Code Here

      Method method = ( Method ) member;
      try {
        value = method.invoke( object );
      }
      catch ( IllegalAccessException e ) {
        throw new ValidationException( "Unable to access " + method.getName(), e );
      }
      catch ( InvocationTargetException e ) {
        throw new ValidationException( "Unable to access " + method.getName(), e );
      }
    }
    else if ( member instanceof Field ) {
      Field field = ( Field ) member;
      try {
        value = field.get( object );
      }
      catch ( IllegalAccessException e ) {
        throw new ValidationException( "Unable to access " + field.getName(), e );
      }
    }
    return value;
  }
View Full Code Here

            throw new ConstraintViolationException(new HashSet<ConstraintViolation<?>>(violations));
        }

        //Check the uniqueness of the email address
        if (emailAlreadyExists(member.getEmail())) {
            throw new ValidationException("Unique Email Violation");
        }
    }
View Full Code Here

      throw new IllegalArgumentException( "At least one groups has to be specified." );
    }

    for ( Class<?> clazz : groups ) {
      if ( !clazz.isInterface() ) {
        throw new ValidationException( "A group has to be an interface. " + clazz.getName() + " is not." );
      }
    }

    GroupChain chain = new GroupChain();
    for ( Class<?> clazz : groups ) {
View Full Code Here

    for ( Method m : declaredMethods ) {
      try {
        parameters.put( m.getName(), m.invoke( annotation ) );
      }
      catch ( IllegalAccessException e ) {
        throw new ValidationException( "Unable to read annotation attributes: " + annotation.getClass(), e );
      }
      catch ( InvocationTargetException e ) {
        throw new ValidationException( "Unable to read annotation attributes: " + annotation.getClass(), e );
      }
    }
    return Collections.unmodifiableMap( parameters );
  }
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.