Changeset 679 in josm for trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
- Timestamp:
- 2008-07-05T14:12:34+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r627 r679 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 2 package org.openstreetmap.josm.tools; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 3 5 4 6 import java.io.Reader; … … 28 30 public class XmlObjectParser implements Iterable<Object> { 29 31 32 public static final String lang = tr("En:").toLowerCase(); 30 33 public static class Uniform<T> implements Iterable<T>{ 31 34 private Iterator<Object> iterator; … … 104 107 Field f = null; 105 108 try { 106 f = c.getClass().getField(fieldName); 107 } catch (NoSuchFieldException e) { 108 } 109 f = c.getClass().getField(fieldName); 110 } catch (NoSuchFieldException e) { 111 if(fieldName.startsWith(lang)) 112 { 113 String locfieldName = "locale_" + 114 fieldName.substring(lang.length()); 115 try { 116 f = c.getClass().getField(locfieldName); 117 } catch (NoSuchFieldException ex) { 118 } 119 } 120 } 109 121 if (f != null && Modifier.isPublic(f.getModifiers())) 110 122 f.set(c, getValueForClass(f.getType(), value)); 111 123 else { 112 fieldName = "set" + fieldName.substring(0,1).toUpperCase() + fieldName.substring(1); 124 if(fieldName.startsWith(lang)) 125 { 126 int l = lang.length(); 127 fieldName = "set" + fieldName.substring(l,l+1).toUpperCase() + fieldName.substring(l+1); 128 } 129 else 130 { 131 fieldName = "set" + fieldName.substring(0,1).toUpperCase() + fieldName.substring(1); 132 } 113 133 Method[] methods = c.getClass().getDeclaredMethods(); 114 134 for (Method m : methods) {
Note:
See TracChangeset
for help on using the changeset viewer.
