@Override public void annotation(Annotation annotation) { try { Meta.OCD ocd = annotation.getAnnotation(Meta.OCD.class); Meta.AD ad = annotation.getAnnotation(Meta.AD.class); if (ocd != null) { MetaTypeReader.this.ocdAnnotation = annotation; } if (ad != null) { assert method != null; // Fixup required since it is default true // but we have no access to these defaults. // i.e. the defaults are implemented in the code // thus here try { if (annotation.get("required") == null) annotation.put("required", true); } catch (Exception e) { // can fail ... see #514 } methods.put(method, ad); } } catch (Exception e) { reporter.error("Error during annotation parsing %s : %s", clazz, e); e.printStackTrace(); } }
@Override public void annotation(Annotation annotation) { try { Meta.OCD ocd = annotation.getAnnotation(Meta.OCD.class); Meta.AD ad = annotation.getAnnotation(Meta.AD.class); if (ocd != null) { MetaTypeReader.this.ocdAnnotation = annotation; } if (ad != null) { assert method != null; // Fixup required since it is default true // but we have no access to these defaults. // i.e. the defaults are implemented in the code // thus here try { if (annotation.get("required") == null) annotation.put("required", true); } catch (Exception e) { // can fail ... see #514 } methods.put(method, ad); } } catch (Exception e) { reporter.error("Error during annotation parsing %s : %s", clazz, e); e.printStackTrace(); } }
private void mergeAttributesAndDirectives(Annotation a) { String fqn = a.getName() .getFQN(); switch (fqn) { case STD_CAPABILITIES : case STD_REQUIREMENTS : Object[] annotations = a.get("value"); for (int i = 0; i < annotations.length; i++) { mergeAttributesAndDirectives((Annotation) annotations[i]); } break; default : if (!attributesAndDirectives.isEmpty()) { Object[] original = a.get("attribute"); int length = (original != null) ? original.length : 0; Object[] updated = new Object[length + attributesAndDirectives.size()]; if (length > 0) { System.arraycopy(original, 0, updated, 0, length); } for (String key : attributesAndDirectives.keySet()) { updated[length++] = attributesAndDirectives.toString(key); } a.put("attribute", updated); } break; } }
private void mergeAttributesAndDirectives(Annotation a) { String fqn = a.getName() .getFQN(); switch (fqn) { case STD_CAPABILITIES : case STD_REQUIREMENTS : Object[] annotations = a.get("value"); for (int i = 0; i < annotations.length; i++) { mergeAttributesAndDirectives((Annotation) annotations[i]); } break; default : if (!attributesAndDirectives.isEmpty()) { Object[] original = a.get("attribute"); int length = (original != null) ? original.length : 0; Object[] updated = new Object[length + attributesAndDirectives.size()]; if (length > 0) { System.arraycopy(original, 0, updated, 0, length); } for (String key : attributesAndDirectives.keySet()) { updated[length++] = attributesAndDirectives.toString(key); } a.put("attribute", updated); } break; } }