- private JaxSet(Class<?> cls) {
- members = new TreeMap<>();
- XmlType xmltype = cls.getAnnotation(XmlType.class);
- Class<?> paramType[] = new Class[] {String.class};
- for(String str : xmltype.propOrder()) {
- try {
- String setName = "set" + Character.toUpperCase(str.charAt(0)) + str.subSequence(1, str.length());
- Method meth = cls.getMethod(setName,paramType );
- if(meth!=null) {
- members.put(str, new Setter<T>(meth) {
- public void set(T o, Object t) throws ParseException {
- try {
- this.meth.invoke(o, t);
- } catch (Exception e) {
- throw new ParseException(e);
- }
- }
- });
- }
- } catch (Exception e) {
- // oops
- }
- }
- }
-
- public static abstract class Setter<O> {
- protected final Method meth;
- public Setter(Method meth) {
- this.meth = meth;
- }
- public abstract void set(O o, Object obj) throws ParseException;
- }
+ private JaxSet(Class<?> cls) {
+ members = new TreeMap<>();
+ XmlType xmltype = cls.getAnnotation(XmlType.class);
+ Class<?> paramType[] = new Class[] {String.class};
+ for(String str : xmltype.propOrder()) {
+ try {
+ String setName = "set" + Character.toUpperCase(str.charAt(0)) + str.subSequence(1, str.length());
+ Method meth = cls.getMethod(setName,paramType );
+ if(meth!=null) {
+ members.put(str, new Setter<T>(meth) {
+ public void set(T o, Object t) throws ParseException {
+ try {
+ this.meth.invoke(o, t);
+ } catch (Exception e) {
+ throw new ParseException(e);
+ }
+ }
+ });
+ }
+ } catch (Exception e) {
+ // oops
+ }
+ }
+ }
+
+ public static abstract class Setter<O> {
+ protected final Method meth;
+ public Setter(Method meth) {
+ this.meth = meth;
+ }
+ public abstract void set(O o, Object obj) throws ParseException;
+ }