Package org.hibernate.validator.spi.valuehandling

Examples of org.hibernate.validator.spi.valuehandling.ValidatedValueUnwrapper


    // Value can be wrapped (e.g. Optional<Address>). Try to unwrap it
    UnwrapMode unwrapMode = cascadable.unwrapMode();
    if ( UnwrapMode.UNWRAP.equals( unwrapMode )
        || UnwrapMode.AUTOMATIC.equals( unwrapMode ) ) {
      ValidatedValueUnwrapper valueHandler = validationContext.getValidatedValueUnwrapper( cascadable.getType() );
      if ( valueHandler != null ) {
        value = valueHandler.handleValidatedValue( value );
      }
    }

    return value;
  }
View Full Code Here


    );
    resolveAssignableTypes( suitableTypesForValidatedValue );

    // if we also have a suitable value unwrapper we resolve for the type provided by the unwrapper as well
    List<Type> suitableTypesForWrappedValue;
    ValidatedValueUnwrapper validatedValueHandler = valueContext.getValidatedValueHandler();
    if ( validatedValueHandler != null) {
      Type unwrappedType = validatedValueHandler.getValidatedValueType( typeOfValidatedElement );
      suitableTypesForWrappedValue = findSuitableValidatorTypes( unwrappedType, availableValidatorTypes );
      resolveAssignableTypes( suitableTypesForWrappedValue );
    }
    else {
      suitableTypesForWrappedValue = Collections.emptyList();
View Full Code Here

      );

      // check for a potential unwrapper

      Type validatedValueType = valueContext.getDeclaredTypeOfValidatedElement();
      ValidatedValueUnwrapper validatedValueUnwrapper = validationContext.getValidatedValueUnwrapper(
          validatedValueType
      );
      if( !valueContext.getUnwrapMode().equals( UnwrapMode.SKIP_UNWRAP )) {
        valueContext.setValidatedValueHandler( validatedValueUnwrapper );
      }
View Full Code Here

TOP

Related Classes of org.hibernate.validator.spi.valuehandling.ValidatedValueUnwrapper

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.