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

Source Code of org.hibernate.validator.test.internal.engine.valuehandling.model.PropertyValueUnwrapper

/*
* Hibernate Validator, declare and validate application constraints
*
* License: Apache License, Version 2.0
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
*/
package org.hibernate.validator.test.internal.engine.valuehandling.model;

import java.lang.reflect.Type;

import com.fasterxml.classmate.ResolvedType;
import com.fasterxml.classmate.TypeResolver;

import org.hibernate.validator.spi.valuehandling.ValidatedValueUnwrapper;

/**
* @author Gunnar Morling
*/
public class PropertyValueUnwrapper extends ValidatedValueUnwrapper<Property<?>> {

  private final TypeResolver typeResolver = new TypeResolver();

  @Override
  public Object handleValidatedValue(Property<?> source) {
    return source.getValue();
  }

  @Override
  public Type getValidatedValueType(Type sourceType) {
    ResolvedType resolvedType = typeResolver.resolve( sourceType );
    return resolvedType.typeParametersFor( Property.class ).get( 0 ).getErasedType();
  }
}
TOP

Related Classes of org.hibernate.validator.test.internal.engine.valuehandling.model.PropertyValueUnwrapper

TOP
Copyright © 2018 www.massapi.com. 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.