Changeset 640


Ignore:
Timestamp:
12/18/13 12:09:33 (11 years ago)
Author:
jts21
Message:

Move check for field type up to the code that populates the map of fields, since there's no point in storing invalid fields. This also means the 'invalid field type' error message will never be reached, but there's no harm in leaving that in, if only as documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/settings/Settings.java

    r639 r640  
    5050                        // populate map of settings with fields
    5151                        for(Field f : clazz.getFields()) {
     52                                Class<?> type = f.getType();
     53                                // only allow valid types
     54                                if(type != String.class &&
     55                                                type != Boolean.class && type != boolean.class &&
     56                                                type != Integer.class && type != int.class &&
     57                                                type != Double.class && type != double.class &&
     58                                                type != Float.class && type != float.class) {
     59                                        continue;
     60                                }
    5261                                FieldSet fs = settings.get(f.getName().toLowerCase());
    5362                                if(fs == null) {
     
    231240                                Object value = "";
    232241                                if(fs.method == null && fs.field != null) {
    233                                         Class<?> type = fs.field.getType();
    234                                 // only allow valid types
    235                                 if(type != String.class &&
    236                                                 type != Boolean.class && type != boolean.class &&
    237                                                 type != Integer.class && type != int.class &&
    238                                                 type != Double.class && type != double.class &&
    239                                                 type != Float.class && type != float.class) {
    240                                         continue;
    241                                 }
    242242                                try {
    243243                                        if(pd.hasDefault.contains(fs.field)) {
Note: See TracChangeset for help on using the changeset viewer.