@@ -104,7 +104,6 @@ private Object analyse(Context ctx, ONode o, Object rst, Class<?> clz, Type type
104104
105105 return analyseVal (ctx , o .nodeData (), clz );
106106 case Object :
107- //clz = getTypeByNode(ctx, o, clz);
108107 o .remove (ctx .options .getTypePropertyName ());//尝试移除类型内容
109108
110109 if (Properties .class .isAssignableFrom (clz )) {
@@ -626,13 +625,7 @@ public Object analyseBean(Context ctx, ONode o, Object rst, Class<?> clz, Type t
626625 }
627626 }
628627
629- try {
630- rst = clzWrap .recordConstructor ().newInstance (argsV );
631- } catch (IllegalArgumentException e ) {
632- throw new IllegalArgumentException ("the constructor missing parameters: " + clz .getName (), e );
633- } catch (Throwable e ) {
634- throw new SnackException ("The instantiation failed, class: " + clz .getName (), e );
635- }
628+ rst = BeanUtil .newInstance (clzWrap .recordConstructor (), argsV );
636629 } else {
637630 //排除字段
638631 Set <String > excNames = null ;
@@ -662,13 +655,7 @@ public Object analyseBean(Context ctx, ONode o, Object rst, Class<?> clz, Type t
662655 }
663656 }
664657
665- try {
666- rst = clzWrap .recordConstructor ().newInstance (argsV );
667- } catch (IllegalArgumentException e ) {
668- throw new IllegalArgumentException ("The constructor missing parameters: " + clz .getName (), e );
669- } catch (Throwable e ) {
670- throw new SnackException ("The instantiation failed, class: " + clz .getName (), e );
671- }
658+ rst = BeanUtil .newInstance (clzWrap .recordConstructor (), argsV );
672659 }
673660 }
674661
@@ -720,7 +707,7 @@ public Object analyseBean(Context ctx, ONode o, Object rst, Class<?> clz, Type t
720707 return rst ;
721708 }
722709
723- private void setValueForMethod (Context ctx , ONode o , Object rst , Map <String , Type > genericInfo , String name , Method method ) throws Exception {
710+ private void setValueForMethod (Context ctx , ONode o , Object rst , Map <String , Type > genericInfo , String name , Method method ) throws Exception {
724711 Class <?> fieldT = method .getParameterTypes ()[0 ];
725712
726713 Object val = analyseBeanOfValue (name , fieldT , null , ctx , o , null , genericInfo );
@@ -735,7 +722,7 @@ private void setValueForMethod(Context ctx, ONode o, Object rst, Map<String, Ty
735722 method .invoke (rst , val );
736723 }
737724
738- private void setValueForField (Context ctx , ONode o , Object rst , Map <String , Type > genericInfo ,FieldWrap f , boolean useSetter , boolean useGetter , Set <String > excNames ) throws Exception {
725+ private void setValueForField (Context ctx , ONode o , Object rst , Map <String , Type > genericInfo , FieldWrap f , boolean useSetter , boolean useGetter , Set <String > excNames ) throws Exception {
739726 if (f .isDeserialize () == false ) {
740727 //不做序列化
741728 return ;
@@ -813,9 +800,9 @@ private Object analyseBeanOfValue(String fieldK, Class fieldT, Type fieldGt, Con
813800 }
814801
815802 if (fieldK == null ) { // key为空,代表扁平化处理
816- return analyse (ctx , o , rst , fieldT , fieldGt , genericInfo );
803+ return analyse (ctx , o , rst , fieldT , fieldGt , genericInfo );
817804 }
818-
805+
819806 return analyse (ctx , o .get (fieldK ), rst , fieldT , fieldGt , genericInfo );
820807 }
821808
0 commit comments