Search in sources :

Example 1 with IConstantFactory

use of com.ikoori.vip.server.common.constant.factory.IConstantFactory in project vip by guangdada.

the class DictFieldWarpperFactory method createFieldWarpper.

public static Object createFieldWarpper(Object field, String methodName) {
    IConstantFactory me = ConstantFactory.me();
    try {
        Method method = IConstantFactory.class.getMethod(methodName, field.getClass());
        Object result = method.invoke(me, field);
        return result;
    } catch (Exception e) {
        try {
            Method method = IConstantFactory.class.getMethod(methodName, Integer.class);
            Object result = method.invoke(me, Integer.parseInt(field.toString()));
            return result;
        } catch (Exception e1) {
            throw new BussinessException(BizExceptionEnum.ERROR_WRAPPER_FIELD);
        }
    }
}
Also used : Method(java.lang.reflect.Method) BussinessException(com.ikoori.vip.common.exception.BussinessException) BussinessException(com.ikoori.vip.common.exception.BussinessException) IConstantFactory(com.ikoori.vip.server.common.constant.factory.IConstantFactory)

Aggregations

BussinessException (com.ikoori.vip.common.exception.BussinessException)1 IConstantFactory (com.ikoori.vip.server.common.constant.factory.IConstantFactory)1 Method (java.lang.reflect.Method)1