All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.addon.validation.InputComponentValueUnwrapper Maven / Gradle / Ivy

There is a newer version: 3.10.0.Final
Show newest version
/**
 * Copyright 2014 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.jboss.addon.validation;

import java.lang.reflect.Type;

import org.hibernate.validator.spi.valuehandling.ValidatedValueUnwrapper;
import org.jboss.forge.addon.ui.input.InputComponent;

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

/**
 * Unwraps the value of a {@link InputComponent}
 * 
 * @author George Gastaldi
 */
class InputComponentValueUnwrapper extends ValidatedValueUnwrapper>
{
   private final TypeResolver typeResolver = new TypeResolver();

   @Override
   public Object handleValidatedValue(InputComponent value)
   {
      return value.getValue();
   }

   @Override
   public Type getValidatedValueType(Type valueType)
   {
      ResolvedType resolvedType = typeResolver.resolve(valueType);
      return resolvedType.typeParametersFor(InputComponent.class).get(1).getErasedType();
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy