public boolean run( Outline model, Options opt, ErrorHandler errorHandler ) { for( ClassOutline co : model.getClasses() ) { Iterator<JAnnotationUse> ann = co.ref.annotations().iterator(); while (ann.hasNext()) { try { JAnnotationUse a = ann.next(); Field clazzField = a.getClass().getDeclaredField("clazz"); clazzField.setAccessible(true); JClass cl = (JClass) clazzField.get(a); if (cl.equals(model.getCodeModel()._ref(XmlAccessorType.class))) { a.param("value", XmlAccessType.PROPERTY); break; } } catch (IllegalArgumentException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchFieldException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } } } return true; }
public boolean run( Outline model, Options opt, ErrorHandler errorHandler ) { for( ClassOutline co : model.getClasses() ) { Iterator<JAnnotationUse> ann = co.ref.annotations().iterator(); while (ann.hasNext()) { try { JAnnotationUse a = ann.next(); Field clazzField = a.getClass().getDeclaredField("clazz"); clazzField.setAccessible(true); JClass cl = (JClass) clazzField.get(a); if (cl.equals(model.getCodeModel()._ref(XmlAccessorType.class))) { a.param("value", XmlAccessType.PROPERTY); break; } } catch (IllegalArgumentException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchFieldException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } } } return true; }
public boolean run( Outline model, Options opt, ErrorHandler errorHandler ) { for( ClassOutline co : model.getClasses() ) { Iterator<JAnnotationUse> ann = co.ref.annotations().iterator(); while (ann.hasNext()) { try { JAnnotationUse a = ann.next(); Field clazzField = a.getClass().getDeclaredField("clazz"); clazzField.setAccessible(true); JClass cl = (JClass) clazzField.get(a); if (cl.equals(model.getCodeModel()._ref(XmlAccessorType.class))) { a.param("value", XmlAccessType.PROPERTY); break; } } catch (IllegalArgumentException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchFieldException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); } } } return true; }
@Override protected void onClass(final ClassOutline classOutline) { String namespace = null; for (final JAnnotationUse annot : classOutline.implClass.annotations()) { final String fullName = annot.getAnnotationClass().fullName(); if (xmlTypeName.equals(fullName)) { final JAnnotationValue value = annot.getAnnotationMembers().get("namespace"); if (value != null) { final StringWriter w = new StringWriter(); value.generate(new JFormatter(w)); namespace = w.toString(); namespace = namespace.substring(1, namespace.length() - 1); // remove quotes } } else if (xmlRootEltName.equals(fullName)) { namespace = null; break; } } if (null == namespace) { return; } classOutline.implClass.annotate(XmlRootElement.class) .param("namespace", namespace) .param("name", toXml(classOutline.implClass.name())); } }