package cn.enilu.flash.core.factory;

import cn.enilu.flash.bean.enumeration.BizExceptionEnum;
import cn.enilu.flash.bean.exception.GunsException;
import cn.enilu.flash.service.system.IConstantFactory;
import cn.enilu.flash.service.system.impl.ConstantFactory;

import java.lang.reflect.Method;

/**
 * 字段的包装创建工厂
 *
 * @author fengshuonan
 * @date 2017-05-06 15:12
 */
public class DictFieldWarpperFactory {

    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 GunsException(BizExceptionEnum.ERROR_WRAPPER_FIELD);
            }
        }
    }

}

@@ -846,16 +846,283 @@
 hodName,
+ Long.class);%0A                Object result = method.invoke(me, Long.valueOf(field.toString()));%0A                return result;%0A            %7D catch (Exception e1) %7B%0A                try %7B%0A                    Method method = IConstantFactory.class.getMethod(methodName,
  Integer
@@ -1122,32 +1122,36 @@
 Integer.class);%0A
+    
                 
@@ -1229,32 +1229,36 @@
                 
+    
 return result;%0A 
@@ -1248,32 +1248,36 @@
  return result;%0A
+    
             %7D ca
@@ -1284,37 +1284,41 @@
 tch (Exception e
-1
+2
 ) %7B%0A
+    
                 
@@ -1380,16 +1380,34 @@
 FIELD);%0A
+                %7D%0A
         

fix bug