protected HashMap<String, FieldDeserializer> getFieldMap(Class cl)
    {
        HashMap<String, FieldDeserializer> fieldMap = new HashMap<String, FieldDeserializer>();

        for (; cl != null; cl = cl.getSuperclass()) {
            Field[] fields = cl.getDeclaredFields();
            for (int i = 0; i < fields.length; i++) {
                Field field = fields[i];

                if (Modifier.isTransient(field.getModifiers())
                    || Modifier.isStatic(field.getModifiers()))
                    continue;
                else if (fieldMap.get(field.getName()) != null)
                    continue;

                // XXX: could parameterize the handler to only deal with public
                try {
                    field.setAccessible(true);
                } catch (Throwable e) {
                    e.printStackTrace();
                }

                Class<?> type = field.getType();
                FieldDeserializer deser;

                if (String.class.equals(type))
                    deser = new StringFieldDeserializer(field);
                else if (byte.class.equals(type)) {
                    deser = new ByteFieldDeserializer(field);
                }
                else if (short.class.equals(type)) {
                    deser = new ShortFieldDeserializer(field);
                }
                else if (int.class.equals(type)) {
                    deser = new IntFieldDeserializer(field);
                }
                else if (long.class.equals(type)) {
                    deser = new LongFieldDeserializer(field);
                }
                else if (float.class.equals(type)) {
                    deser = new FloatFieldDeserializer(field);
                }
                else if (double.class.equals(type)) {
                    deser = new DoubleFieldDeserializer(field);
                }
                else if (boolean.class.equals(type)) {
                    deser = new BooleanFieldDeserializer(field);
                }
                else if (java.sql.Date.class.equals(type)) {
                    deser = new SqlDateFieldDeserializer(field);
                }
                else if (java.sql.Timestamp.class.equals(type)) {
                    deser = new SqlTimestampFieldDeserializer(field);
                }
                else if (java.sql.Time.class.equals(type)) {
                    deser = new SqlTimeFieldDeserializer(field);
                }
                else {
                    deser = new ObjectFieldDeserializer(field);
                }

                fieldMap.put(field.getName(), deser);
            }
        }

        return fieldMap;
    }
protected HashMap < String , FieldDeserializer > getFieldMap ( Class cl ) { HashMap < String , FieldDeserializer > fieldMap = new HashMap < String , FieldDeserializer > ( ) ; for ( ; cl != null ; cl = cl . getSuperclass ( ) ) { Field [ ] fields = cl . getDeclaredFields ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { Field field = fields [ i ] ; if ( Modifier . isTransient ( field . getModifiers ( ) ) || Modifier . isStatic ( field . getModifiers ( ) ) ) continue ; else if ( fieldMap . get ( field . getName ( ) ) != null ) continue ; try { field . setAccessible ( true ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } Class < ? > type = field . getType ( ) ; FieldDeserializer deser ; if ( String . class . equals ( type ) ) deser = new StringFieldDeserializer ( field ) ; else if ( byte . class . equals ( type ) ) { deser = new ByteFieldDeserializer ( field ) ; } else if ( short . class . equals ( type ) ) { deser = new ShortFieldDeserializer ( field ) ; } else if ( int . class . equals ( type ) ) { deser = new IntFieldDeserializer ( field ) ; } else if ( long . class . equals ( type ) ) { deser = new LongFieldDeserializer ( field ) ; } else if ( float . class . equals ( type ) ) { deser = new FloatFieldDeserializer ( field ) ; } else if ( double . class . equals ( type ) ) { deser = new DoubleFieldDeserializer ( field ) ; } else if ( boolean . class . equals ( type ) ) { deser = new BooleanFieldDeserializer ( field ) ; } else if ( java . sql . Date . class . equals ( type ) ) { deser = new SqlDateFieldDeserializer ( field ) ; } else if ( java . sql . Timestamp . class . equals ( type ) ) { deser = new SqlTimestampFieldDeserializer ( field ) ; } else if ( java . sql . Time . class . equals ( type ) ) { deser = new SqlTimeFieldDeserializer ( field ) ; } else { deser = new ObjectFieldDeserializer ( field ) ; } fieldMap . put ( field . getName ( ) , deser ) ; } } return fieldMap ; }
Creates a map of the classes fields.