protected Constructor parseConstructor(ConstructorDoc constructorDoc) { Constructor constructorNode = objectFactory.createConstructor(); constructorNode.setName(constructorDoc.name()); constructorNode.setQualified(constructorDoc.qualifiedName()); String comment = constructorDoc.commentText(); if (comment.length() > 0) { constructorNode.setComment(comment); } constructorNode.setScope(parseScope(constructorDoc)); constructorNode.setIncluded(constructorDoc.isIncluded()); constructorNode.setFinal(constructorDoc.isFinal()); constructorNode.setNative(constructorDoc.isNative()); constructorNode.setStatic(constructorDoc.isStatic()); constructorNode.setSynchronized(constructorDoc.isSynchronized()); constructorNode.setVarArgs(constructorDoc.isVarArgs()); constructorNode.setSignature(constructorDoc.signature()); for (Parameter parameter : constructorDoc.parameters()) { constructorNode.getParameter().add(parseMethodParameter(parameter)); } for (Type exceptionType : constructorDoc.thrownExceptionTypes()) { constructorNode.getException().add(parseTypeInfo(exceptionType)); } for (AnnotationDesc annotationDesc : constructorDoc.annotations()) { constructorNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, constructorDoc.qualifiedName())); } for (Tag tag : constructorDoc.tags()) { constructorNode.getTag().add(parseTag(tag)); } return constructorNode; }
public static boolean start(RootDoc root) { Map<String, DocString> docStrings = new HashMap<>(); ClassDoc[] classes = root.classes(); for (ClassDoc classDoc : classes) { for (ConstructorDoc constructorDoc : classDoc.constructors()) { if (constructorDoc.annotations().length != 0) { if (isConstructorAnnotated(constructorDoc)) { Map<String, String> params = ParamStringProcessor.getNameToCommentMapping(constructorDoc); DocString docString = new DocString(constructorDoc.commentText(), params); docStrings.put(constructorDoc.qualifiedName(), docString); } } } } writeDocStringsToFile(docStrings); return true; }
/** Print the class's constructors m */ private boolean operations(Options opt, ConstructorDoc m[]) { boolean printed = false; for (ConstructorDoc cd : m) { if (hidden(cd)) continue; stereotype(opt, cd, Align.LEFT); String cs = visibility(opt, cd) + cd.name() // + (opt.showType ? "(" + parameter(opt, cd.parameters()) + ")" : "()"); tableLine(Align.LEFT, cs); tagvalue(opt, cd); printed = true; } return printed; }
result = factory.constructOperation( doc.name() ); result.setSpecification( false ); // assume the method exists, so it is not a specification result.setQuery( false ); // the constructors are not read-only factory.constructTagDocumentation( result, doc.commentText() ); if ( doc.isPublic() ) { result.setVisibility( VisibilityKindEnum.VK_PUBLIC ); } else if ( doc.isPrivate() ) { result.setVisibility( VisibilityKindEnum.VK_PRIVATE ); } else if ( doc.isProtected() ) { result.setVisibility( VisibilityKindEnum.VK_PROTECTED ); if ( doc.isStatic() ) { result.setOwnerScope( ScopeKindEnum.SK_CLASSIFIER ); } else { if ( doc.isSynchronized() ) { result.setConcurrency( CallConcurrencyKindEnum.CCK_SEQUENTIAL ); } else { parameters = doc.parameters(); parameterTags = doc.paramTags(); parameterComment = findComment( JAVADOC_RETURN_TAG_NAME, doc.tags() ); if ( parameterComment != null ) { factory.constructTagDocumentation( parameter, parameterComment );
/** * {@inheritDoc} */ public Content getSignature(ConstructorDoc constructor) { Content pre = new HtmlTree(HtmlTag.PRE); writer.addAnnotationInfo(constructor, pre); addModifiers(constructor, pre); if (configuration.linksource) { Content constructorName = new StringContent(constructor.name()); writer.addSrcLink(constructor, constructorName, pre); } else { addName(constructor.name(), pre); } int indent = pre.charCount(); addParameters(constructor, pre, indent); addExceptions(constructor, pre, indent); return pre; }
if (Docs.equalParameters(parameterTypes, cd.parameters())) return cd;
static Map<String, String> getNameToCommentMapping(ConstructorDoc constructorDoc) { ImmutableMap.Builder<String, String> nameToCommentMapping = ImmutableMap.builder(); Tag[] params = constructorDoc.tags("@param"); for (Tag param: params) { String[] text = param.text().split(" ", 2); String snakeCaseParamName = UPPER_CAMEL.to(LOWER_UNDERSCORE, text[0]); String paramComment = text[1].trim(); nameToCommentMapping.put(snakeCaseParamName, paramComment); } return nameToCommentMapping.build(); } }
ConstructorDoc toConstructorDoc = (ConstructorDoc) to; defaultLabelHtml += ( toConstructorDoc.containingClass().name() + this.prettyPrintParameterList(toConstructorDoc) );
private static boolean isConstructorAnnotated(ConstructorDoc constructorDoc) { return Arrays.stream(constructorDoc.annotations()) .anyMatch(an -> an.toString().equals(EXPORT_VERTEX_ANNOTATION_NAME)); }
/** Print the class's constructors m */ private boolean operations(Options opt, ConstructorDoc m[]) { boolean printed = false; for (ConstructorDoc cd : m) { if (hidden(cd)) continue; stereotype(opt, cd, Align.LEFT); String cs = visibility(opt, cd) + cd.name(); if (opt.showType) { cs += "(" + parameter(opt, cd.parameters()) + ")"; } else { cs += "()"; } tableLine(Align.LEFT, cs); printed = true; tagvalue(opt, cd); } return printed; }
/** * Write the signature for the given constructor. * * @param constructor the constructor being documented. */ public void writeSignature(ConstructorDoc constructor) { writer.displayLength = 0; writer.pre(); writer.writeAnnotationInfo(constructor); printModifiers(constructor); //printReturnType((ConstructorDoc)constructor); if (configuration().linksource) { writer.printSrcLink(constructor, constructor.name()); } else { strong(constructor.name()); } writeParameters(constructor); writeExceptions(constructor); writer.preEnd(); assert !writer.getMemberDetailsListPrinted(); }
if (Docs.equalParameters(parameterTypes, cd.parameters())) return cd;
@Before public void initialiseMocks() { when(constructorDoc.tags(PARAM_TAG_NAME)).thenReturn(new Tag[] {tag1, tag2}); when(tag1.name()).thenReturn(PARAM_TAG_NAME); when(tag1.text()).thenReturn(FIRST_PARAM_TEXT); when(tag2.name()).thenReturn(PARAM_TAG_NAME); when(tag2.text()).thenReturn(SECOND_PARAM_TEXT); when(tag3.name()).thenReturn(RETURN_TAG_NAME); when(tag3.text()).thenReturn(RETURN_TAG_TEXT); }
ConstructorDoc toConstructorDoc = (ConstructorDoc) to; defaultLabelHtml += ( toConstructorDoc.containingClass().name() + this.prettyPrintParameterList(toConstructorDoc) );
/** * Write the constructor header for the given constructor. * * @param constructor the constructor being documented. * @param isFirst the flag to indicate whether or not the constructor is the * first to be documented. */ public void writeConstructorHeader(ConstructorDoc constructor, boolean isFirst) { if (! isFirst) { writer.printMemberHeader(); } writer.println(); String erasureAnchor; if ((erasureAnchor = getErasureAnchor(constructor)) != null) { writer.anchor(erasureAnchor); } writer.anchor(constructor); writer.h3(); writer.print(constructor.name()); writer.h3End(); }
/** * Generates the "fragment" identifier for the given <var>doc</var>. * <dl> * <dt>{@link FieldDoc}:</dt> * <dd>{@code "#fieldName"}</dd> * <dt>{@link MethodDoc}:</dt> * <dd>{@code "#methodName(java.lang.String,int)"}</dd> * <dt>Other:</dt> * <dd>{@code ""}</dd> * </dl> */ private static String fragmentIdentifier(Doc doc) { if (doc.isField()) return '#' + doc.name(); if (doc.isConstructor()) { ConstructorDoc constructorDoc = (ConstructorDoc) doc; return ( '#' + constructorDoc.containingClass().name() + Html.parameterListForFragmentIdentifier(constructorDoc) ); } if (doc.isMethod()) { MethodDoc methodDoc = (MethodDoc) doc; return '#' + doc.name() + Html.parameterListForFragmentIdentifier(methodDoc); } return ""; }
/** * {@inheritDoc} */ public Content getConstructorDocTreeHeader(ConstructorDoc constructor, Content constructorDetailsTree) { String erasureAnchor; if ((erasureAnchor = getErasureAnchor(constructor)) != null) { constructorDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor))); } constructorDetailsTree.addContent( writer.getMarkerAnchor(writer.getAnchor(constructor))); Content constructorDocTree = writer.getMemberTreeHeader(); Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(constructor.name()); constructorDocTree.addContent(heading); return constructorDocTree; }
/** * Generates the "fragment" identifier for the given <var>doc</var>. * <dl> * <dt>{@link FieldDoc}:</dt> * <dd>{@code "#fieldName"}</dd> * <dt>{@link MethodDoc}:</dt> * <dd>{@code "#methodName(java.lang.String,int)"}</dd> * <dt>Other:</dt> * <dd>{@code ""}</dd> * </dl> */ private static String fragmentIdentifier(Doc doc) { if (doc.isField()) return '#' + doc.name(); if (doc.isConstructor()) { ConstructorDoc constructorDoc = (ConstructorDoc) doc; return ( '#' + constructorDoc.containingClass().name() + Html.parameterListForFragmentIdentifier(constructorDoc) ); } if (doc.isMethod()) { MethodDoc methodDoc = (MethodDoc) doc; return '#' + doc.name() + Html.parameterListForFragmentIdentifier(methodDoc); } return ""; }