X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=misc%2Frosetta%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fmisc%2Frosetta%2FJaxSet.java;h=6a779fb812e9b01b2f7acb36a5e50dc7f4eccda7;hb=4b5a7d721d994a49057e9bfb403c7bff1b376660;hp=04d615819823caf0cf6d5b6e29decf2827c35836;hpb=824dc7b5fc0e1ccdf7f460479aff344727f0f01e;p=aaf%2Fauthz.git diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java index 04d61581..6a779fb8 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java @@ -38,54 +38,54 @@ import javax.xml.bind.annotation.XmlType; * @param */ public class JaxSet { - private static Map,JaxSet> jsets = new HashMap<>(); - private Map> members; + private static Map,JaxSet> jsets = new HashMap<>(); + private Map> members; - 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(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 { - 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(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 { + protected final Method meth; + public Setter(Method meth) { + this.meth = meth; + } + public abstract void set(O o, Object obj) throws ParseException; + } - public static JaxSet get(Class cls) { - synchronized(jsets) { - @SuppressWarnings("unchecked") - JaxSet js = (JaxSet)jsets.get(cls); - if(js == null) { - jsets.put(cls, js = new JaxSet<>(cls)); - } - return js; - } - } + public static JaxSet get(Class cls) { + synchronized(jsets) { + @SuppressWarnings("unchecked") + JaxSet js = (JaxSet)jsets.get(cls); + if(js == null) { + jsets.put(cls, js = new JaxSet<>(cls)); + } + return js; + } + } - public Setter get(String key) { - return members.get(key); - } + public Setter get(String key) { + return members.get(key); + } }