Ignore:
Timestamp:
04/17/19 11:30:18 (5 years ago)
Author:
bln4
Message:

Added the ability to use strings as item tags in .exp files. In order to maintain back compatibility and to maximise efficiency, these strings must start with a underscore character.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/io/ExpWriter.java

    r1208 r1321  
    277277        private void writeClass(Object toWrite) throws IOException {
    278278                Iterator<Character> it = _ItemTags.keySet().iterator();
     279                Iterator<String> itExt = _ItemTagsExt.keySet().iterator();
    279280                Object[] param = {};
    280281
     
    300301                        }
    301302                }
     303               
     304                while (itExt.hasNext()) {
     305                        String tag = itExt.next();
     306                        Method toRun = _ItemTagsExt.get(tag);
     307                        Class<?> declarer = toRun.getDeclaringClass();
     308                        if (declarer.isAssignableFrom(toWrite.getClass())) {
     309                                try {
     310                                        Object o = toRun.invoke(toWrite, param);
     311                                        o = Conversion.ConvertToExpeditee(toRun, o);
     312                                        if (o != null) {
     313                                                if (o instanceof List) {
     314                                                        for (Object line : (List) o) {
     315                                                                writeLine(tag.toString(), line.toString());
     316                                                        }
     317                                                } else
     318                                                        writeLine(tag.toString(), o.toString());
     319                                        }
     320                                } catch (Exception e) {
     321                                        e.printStackTrace();
     322                                }
     323                        }
     324                }
    302325        }
    303326
Note: See TracChangeset for help on using the changeset viewer.