/** * Filter the annotation type members and return either the required * members or the optional members, depending on the value of the * required parameter. * * @param doc The annotation type to process. * @param required * @return the annotation type members and return either the required * members or the optional members, depending on the value of the * required parameter. */ private AnnotationTypeElementDoc[] filter(AnnotationTypeDoc doc, boolean required) { AnnotationTypeElementDoc[] members = doc.elements(); List<AnnotationTypeElementDoc> targetMembers = new ArrayList<AnnotationTypeElementDoc>(); for (int i = 0; i < members.length; i++) { if ((required && members[i].defaultValue() == null) || ((!required) && members[i].defaultValue() != null)){ targetMembers.add(members[i]); } } return targetMembers.toArray(new AnnotationTypeElementDoc[]{}); }
/** * Filter the annotation type members and return either the required * members or the optional members, depending on the value of the * required parameter. * * @param doc The annotation type to process. * @param required * @return the annotation type members and return either the required * members or the optional members, depending on the value of the * required parameter. */ private AnnotationTypeElementDoc[] filter(AnnotationTypeDoc doc, boolean required) { AnnotationTypeElementDoc[] members = doc.elements(); List<AnnotationTypeElementDoc> targetMembers = new ArrayList<AnnotationTypeElementDoc>(); for (int i = 0; i < members.length; i++) { if ((required && members[i].defaultValue() == null) || ((!required) && members[i].defaultValue() != null)){ targetMembers.add(members[i]); } } return targetMembers.toArray(new AnnotationTypeElementDoc[]{}); }
public void writeAnnotationTable(AnnotationDesc annotation, StringBuilder sb) { AnnotationTypeElementDoc[] annotationElements = annotation.annotationType().elements(); if (annotationElements.length > 0) { Map<String, String> elementValueMap = createElementValueMap(annotation); sb.append(String.format("\t\t%1$20s %2$20s %3$20s\n", "NAME", "VALUE", "DEFAULT")); for (AnnotationTypeElementDoc annotationElement : annotationElements) { sb.append(String.format("\t\t%1$20s %2$20s %3$20s\n", annotationElement.name(), elementValueMap.get(annotationElement.name()), annotationElement.defaultValue())); } } }
/** * {@inheritDoc} */ public void addDefaultValueInfo(MemberDoc member, Content annotationDocTree) { if (((AnnotationTypeElementDoc) member).defaultValue() != null) { Content dt = HtmlTree.DT(writer.getResource("doclet.Default")); Content dl = HtmlTree.DL(dt); Content dd = HtmlTree.DD(new StringContent( ((AnnotationTypeElementDoc) member).defaultValue().toString())); dl.addContent(dd); annotationDocTree.addContent(dl); } }
/** * {@inheritDoc} */ public void writeDefaultValueInfo(MemberDoc member) { if (((AnnotationTypeElementDoc) member).defaultValue() != null) { writer.printMemberDetailsListStartTag(); writer.dd(); writer.dl(); writer.dt(); writer.strong(ConfigurationImpl.getInstance(). getText("doclet.Default")); writer.dtEnd(); writer.dd(); writer.print(((AnnotationTypeElementDoc) member).defaultValue()); writer.ddEnd(); writer.dlEnd(); writer.ddEnd(); } }
/** * Parse the elements of an annotation * * @param annotationTypeElementDoc * A AnnotationTypeElementDoc instance * @return the annotation element node */ protected AnnotationElement parseAnnotationTypeElementDoc(AnnotationTypeElementDoc annotationTypeElementDoc) { AnnotationElement annotationElementNode = objectFactory.createAnnotationElement(); annotationElementNode.setName(annotationTypeElementDoc.name()); annotationElementNode.setQualified(annotationTypeElementDoc.qualifiedName()); annotationElementNode.setType(parseTypeInfo(annotationTypeElementDoc.returnType())); AnnotationValue value = annotationTypeElementDoc.defaultValue(); if (value != null) { annotationElementNode.setDefault(value.toString()); } return annotationElementNode; }