Package org.hibernate.validator.internal.engine.valuehandling

Examples of org.hibernate.validator.internal.engine.valuehandling.UnwrapMode


    else {
      value = object;
    }

    // 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 );
View Full Code Here


        field.getAnnotation( ConvertGroup.List.class )
    );

    boolean isCascading = field.isAnnotationPresent( Valid.class );
    UnwrapValidatedValue unwrapValidatedValue = field.getAnnotation( UnwrapValidatedValue.class );
    UnwrapMode unwrapMode = UnwrapMode.AUTOMATIC;
    if ( unwrapValidatedValue != null ) {
      unwrapMode = unwrapValidatedValue.value() ? UnwrapMode.UNWRAP : UnwrapMode.SKIP_UNWRAP;
    }

    Set<MetaConstraint<?>> typeArgumentsConstraints = findTypeAnnotationConstraintsForMember( field );
View Full Code Here

    Set<MetaConstraint<?>> returnValueConstraints;
    Set<MetaConstraint<?>> typeArgumentsConstraints;
    Map<Class<?>, Class<?>> groupConversions;
    boolean isCascading;

    UnwrapMode unwrapMode = UnwrapMode.AUTOMATIC;
    if ( annotationProcessingOptions.areReturnValueConstraintsIgnoredFor( executable.getMember() ) ) {
      returnValueConstraints = Collections.emptySet();
      typeArgumentsConstraints = Collections.<MetaConstraint<?>>emptySet();
      groupConversions = Collections.emptyMap();
      isCascading = false;
View Full Code Here

        );
        i++;
        continue;
      }

      UnwrapMode unwrapMode = UnwrapMode.AUTOMATIC;
      for ( Annotation parameterAnnotation : parameterAnnotations ) {
        //1. mark parameter as cascading if this annotation is the @Valid annotation
        if ( parameterAnnotation.annotationType().equals( Valid.class ) ) {
          parameterIsCascading = true;
        }
View Full Code Here

      // HV-925
      // Trying to detect inconsistent value unwrapping configuration between a property field and its getter.
      // If a field or getter explicitly uses @UnwrapValidatedValue, the corresponding getter / field needs to either
      // not use @UnwrapValidatedValue or use the same value for the annotation.
      UnwrapMode newUnwrapMode = constrainedElement.unwrapMode();
      if ( unwrapModeExplicitlyConfigured ) {
        if ( !UnwrapMode.AUTOMATIC.equals( newUnwrapMode ) && !newUnwrapMode.equals( unwrapMode ) ) {
          throw log.getInconsistentValueUnwrappingConfigurationBetweenFieldAndItsGetterException(
              propertyName,
              getBeanClass().getName()
          );
        }
View Full Code Here

    else {
      mergedName = other.name;
    }

    // TODO - Is this the right way of handling the merge of unwrapMode? (HF)
    UnwrapMode mergedUnwrapMode;
    if ( source.getPriority() > other.source.getPriority() ) {
      mergedUnwrapMode = unwrapMode;
    }
    else {
      mergedUnwrapMode = other.unwrapMode;
View Full Code Here

    Map<Class<?>, Class<?>> mergedGroupConversions = newHashMap( groupConversions );
    mergedGroupConversions.putAll( other.groupConversions );

    // TODO - Is this the right way of handling the merge of unwrapMode? (HF)
    UnwrapMode mergedUnwrapMode;
    if ( source.getPriority() > other.source.getPriority() ) {
      mergedUnwrapMode = unwrapMode;
    }
    else {
      mergedUnwrapMode = other.unwrapMode;
View Full Code Here

    Type typeOfValidatedElement = valueContext.getDeclaredTypeOfValidatedElement();
    Contracts.assertNotNull( typeOfValidatedElement );
    Contracts.assertNotNull( descriptor );
    Contracts.assertNotNull( constraintValidatorFactory );

    UnwrapMode valueUnwrapMode = valueContext.getUnwrapMode();
    final CacheKey key = new CacheKey(
        descriptor.getAnnotation(),
        typeOfValidatedElement,
        constraintValidatorFactory,
        valueUnwrapMode
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.engine.valuehandling.UnwrapMode

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.