Package com.firefly.utils.json.support

Examples of com.firefly.utils.json.support.FieldHandle


              && Modifier.isTransient(field.getModifiers())) {
            continue;
          }

          try {
            FieldHandle fieldSerializer = new FieldHandle();
            fieldSerializer.setPropertyName(propertyName);
            fieldSerializer.setMethod(method);
            fieldList.add(fieldSerializer);

            appendPair(propertyName, method.invoke(obj));
            sb.append(SEPARATOR);
          } catch (IllegalArgumentException e) {
            e.printStackTrace();
          } catch (IllegalAccessException e) {
            e.printStackTrace();
          } catch (InvocationTargetException e) {
            e.printStackTrace();
          }
        } else if (methodName.startsWith("is")) { // 取is方法的返回值
          if (methodName.length() < 3
              || !Character.isUpperCase(methodName.charAt(2))) {
            continue;
          }

          String propertyName = Character.toLowerCase(methodName
              .charAt(2))
              + methodName.substring(3);

          Field field = null;
          try {
            field = clazz.getDeclaredField(propertyName);
          } catch (SecurityException e) {
            e.printStackTrace();
          } catch (NoSuchFieldException e) {
            e.printStackTrace();
          }
          if (field != null
              && Modifier.isTransient(field.getModifiers())) {
            continue;
          }

          try {
            FieldHandle fieldSerializer = new FieldHandle();
            fieldSerializer.setPropertyName(propertyName);
            fieldSerializer.setMethod(method);
            fieldList.add(fieldSerializer);

            appendPair(propertyName, method.invoke(obj));
            sb.append(SEPARATOR);
          } catch (IllegalArgumentException e) {
View Full Code Here

TOP

Related Classes of com.firefly.utils.json.support.FieldHandle

Copyright © 2018 www.massapicom. 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.