Package org.activejpa.util

Source Code of org.activejpa.util.ConvertUtil

/**
*
*/
package org.activejpa.util;

import java.lang.reflect.Method;

import org.activejpa.ActiveJpaException;

/**
* @author ganeshs
*
*/
public class ConvertUtil {

  /**
   * @param value
   * @param targetType
   */
  public static Object convert(Object value, Class<?> targetType) {
    try {
      Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass("org.apache.commons.beanutils.ConvertUtils");
      Method method = clazz.getMethod("convert", Object.class, Class.class);
      return method.invoke(null, value, targetType);
    } catch (Exception e) {
      throw new ActiveJpaException("Failed while converting the type", e);
    }
  }
}
TOP

Related Classes of org.activejpa.util.ConvertUtil

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.