Package org.hibernate.validator.internal.metadata.aggregated

Examples of org.hibernate.validator.internal.metadata.aggregated.ParameterMetaData


  @Test
  public void parameterRequiringUnwrapping() throws Exception {
    Method method = CustomerRepository.class.getMethod( "methodWithParameterRequiringUnwrapping", long.class );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor( ExecutableElement.forMethod( method ) );

    ParameterMetaData parameterMetaData = methodMetaData.getParameterMetaData( 0 );

    assertEquals( parameterMetaData.unwrapMode(), UnwrapMode.UNWRAP );
  }
View Full Code Here


      // 2. validate parameter constraints
      for ( int i = 0; i < parameterValues.length; i++ ) {
        PathImpl originalPath = valueContext.getPropertyPath();

        ParameterMetaData parameterMetaData = executableMetaData.getParameterMetaData( i );
        Object value = parameterValues[i];

        if ( value != null ) {
          Class<?> valueType = value.getClass();
          if ( parameterMetaData.getType() instanceof Class && ( (Class<?>) parameterMetaData.getType() ).isPrimitive() ) {
            valueType = ReflectionHelper.unBoxedType( valueType );
          }
          if ( !TypeHelper.isAssignable( TypeHelper.getErasedType( parameterMetaData.getType() ), valueType ) ) {
            throw log.getParameterTypesDoNotMatchException(
                valueType.getName(),
                parameterMetaData.getType().toString(),
                i,
                validationContext.getExecutable().getMember()
            );
          }
        }
View Full Code Here

      // 2. validate parameter constraints
      for ( int i = 0; i < parameterValues.length; i++ ) {
        PathImpl originalPath = valueContext.getPropertyPath();

        ParameterMetaData parameterMetaData = executableMetaData.getParameterMetaData( i );
        Object value = parameterValues[i];

        if ( value != null ) {
          Class<?> valueType = value.getClass();
          if ( parameterMetaData.getType() instanceof Class && ( (Class<?>) parameterMetaData.getType() ).isPrimitive() ) {
            valueType = ReflectionHelper.unBoxedType( valueType );
          }
          if ( !TypeHelper.isAssignable( TypeHelper.getErasedType( parameterMetaData.getType() ), valueType ) ) {
            throw log.getParameterTypesDoNotMatchException(
                valueType.getName(),
                parameterMetaData.getType().toString(),
                i,
                validationContext.getExecutable().getMember()
            );
          }
        }
View Full Code Here

    // validate parameter beans annotated with @Valid if required
    for ( int i = 0; i < parameterValues.length; i++ ) {

      Object value = parameterValues[i];
      ParameterMetaData parameterMetaData = methodMetaData.getParameterMetaData( i );
      String parameterName = parameterMetaData.getName();

      if ( parameterMetaData.isCascading() && value != null ) {

        ValueContext<Object, ?> cascadingValueContext = ValueContext.getLocalExecutionContext(
            value, PathImpl.createPathForParameter( executable, parameterName ), i, parameterName
        );
        cascadingValueContext.setCurrentGroup( group.getDefiningClass() );
View Full Code Here

      // 2. validate parameter constraints
      for ( int i = 0; i < parameterValues.length; i++ ) {
        PathImpl originalPath = valueContext.getPropertyPath();

        ParameterMetaData parameterMetaData = executableMetaData.getParameterMetaData( i );
        Object value = parameterValues[i];

        if ( value != null ) {
          Class<?> valueType = value.getClass();
          if ( parameterMetaData.getType() instanceof Class && ( (Class<?>) parameterMetaData.getType() ).isPrimitive() ) {
            valueType = ReflectionHelper.unBoxedType( valueType );
          }
          if ( !TypeHelper.isAssignable( parameterMetaData.getType(), valueType ) ) {
            throw log.getParameterTypesDoNotMatchException(
                valueType.getName(),
                parameterMetaData.getType().toString(),
                i,
                validationContext.getExecutable().getMember()
            );
          }
        }
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.metadata.aggregated.ParameterMetaData

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.