com.sun.source.doctree.SerialFieldTree Java Examples

The following examples show how to use com.sun.source.doctree.SerialFieldTree. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImmutableDocTreeTranslator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected final SerialFieldTree rewriteChildren(SerialFieldTree tree) {
    SerialFieldTree value = tree;
    IdentifierTree name = (IdentifierTree) translate(tree.getName());
    List<? extends DocTree> description = translateDoc(tree.getDescription());
    ReferenceTree ref = (ReferenceTree) translate(tree.getType());
    if (ref != tree.getType() || name != tree.getName() || description != tree.getDescription()) {
        value = make.SerialField(name, ref, description);
    }
    return value;
}
 
Example #2
Source File: VeryPretty.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitSerialField(SerialFieldTree node, Void p) {
    printTagName(node);
    print(" ");
    print((DCTree)node.getName());
    print(" ");
    print((DCTree)node.getType());
    if (!node.getDescription().isEmpty()) {
        print(" ");
        for (DocTree docTree : node.getDescription()) {
            doAccept((DCTree)docTree);
        }
    }
    return null;
}
 
Example #3
Source File: Utils.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a Comparator for SerialFieldTree.
 * @return a Comparator
 */
public Comparator<SerialFieldTree> makeSerialFieldTreeComparator() {
    return (SerialFieldTree o1, SerialFieldTree o2) -> {
        String s1 = o1.getName().toString();
        String s2 = o2.getName().toString();
        return s1.compareTo(s2);
    };
}
 
Example #4
Source File: CommentHelper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ReferenceTree getType(DocTree dtree) {
    if (dtree.getKind() == SERIAL_FIELD) {
        return ((SerialFieldTree)dtree).getType();
    } else {
        return null;
    }
}
 
Example #5
Source File: CommentHelper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public IdentifierTree getName(DocTree dtree) {
    switch (dtree.getKind()) {
        case PARAM:
            return ((ParamTree)dtree).getName();
        case SERIAL_FIELD:
            return ((SerialFieldTree)dtree).getName();
        default:
            return null;
        }
}
 
Example #6
Source File: Analyzer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitSerialField(SerialFieldTree node, List<ErrorDescription> errors) {
    boolean oldInheritDoc = foundInheritDoc;
    super.visitSerialField(node, errors);
    foundInheritDoc = oldInheritDoc;
    return null;
}
 
Example #7
Source File: RefactoringVisitor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public DocTree visitSerialField(SerialFieldTree node, Element p, Void ignore) {
    return super.visitSerialField(node, p);
}
 
Example #8
Source File: Checker.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void visitSerialField(SerialFieldTree tree, Void ignore) {
    warnIfEmpty(tree, tree.getDescription());
    return super.visitSerialField(tree, ignore);
}
 
Example #9
Source File: Checker.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void visitSerialField(SerialFieldTree tree, Void ignore) {
    warnIfEmpty(tree, tree.getDescription());
    return super.visitSerialField(tree, ignore);
}
 
Example #10
Source File: Checker.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void visitSerialField(SerialFieldTree tree, Void ignore) {
    warnIfEmpty(tree, tree.getDescription());
    return super.visitSerialField(tree, ignore);
}
 
Example #11
Source File: SerializedFormBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Build the serial field tags information.
 *
 * @param serializableFieldsTree content tree to which the documentation will be added
 */
public void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
    if(configuration.nocomment){
        return;
    }
    VariableElement field = (VariableElement)currentMember;
    // Process Serializable Fields specified as array of
    // ObjectStreamFields. Print a member for each serialField tag.
    // (There should be one serialField tag per ObjectStreamField
    // element.)
    SortedSet<SerialFieldTree> tags = new TreeSet<>(utils.makeSerialFieldTreeComparator());
    // sort the elements
    for (DocTree dt : utils.getSerialFieldTrees(field)) {
        SerialFieldTree st = (SerialFieldTree) dt;
        tags.add(st);
    }

    CommentHelper ch = utils.getCommentHelper(field);
    for (SerialFieldTree tag : tags) {
        if (tag.getName() == null || tag.getType() == null)  // ignore malformed @serialField tags
            continue;
        Content fieldsContentTree = fieldWriter.getFieldsContentHeader(tag.equals(tags.last()));
        TypeElement te = ch.getReferencedClass(configuration, tag);
        String fieldType = ch.getReferencedMemberName(tag);
        if (te != null && utils.isPrimitive(te.asType())) {
            fieldType = utils.getTypeName(te.asType(), false);
            te = null;
        }
        String refSignature = ch.getReferencedSignature(tag);
        // TODO: Print the signature directly, if it is an array, the
        // current DocTree APIs makes it very hard to distinguish
        // an as these are returned back as "Array" a DeclaredType.
        if (refSignature.endsWith("[]")) {
            te = null;
            fieldType = refSignature;
        }
        fieldWriter.addMemberHeader(te, fieldType, "",
                tag.getName().getName().toString(), fieldsContentTree);
        fieldWriter.addMemberDescription(field, tag, fieldsContentTree);
        serializableFieldsTree.addContent(fieldsContentTree);
    }
}
 
Example #12
Source File: Checker.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitSerialField(SerialFieldTree tree, Void ignore) {
    warnIfEmpty(tree, tree.getDescription());
    return super.visitSerialField(tree, ignore);
}
 
Example #13
Source File: Checker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void visitSerialField(SerialFieldTree tree, Void ignore) {
    warnIfEmpty(tree, tree.getDescription());
    return super.visitSerialField(tree, ignore);
}
 
Example #14
Source File: Checker.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void visitSerialField(SerialFieldTree tree, Void ignore) {
    warnIfEmpty(tree, tree.getDescription());
    return super.visitSerialField(tree, ignore);
}
 
Example #15
Source File: RefactoringVisitor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public DocTree visitSerialField(SerialFieldTree node, Element p) {
    return instance.visitSerialField(node, p);
}
 
Example #16
Source File: RefactoringVisitor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * @since 1.47
 */
@Override
public DocTree visitSerialField(SerialFieldTree node, Element p) {
    return docScanner.visitSerialField(node, p, null);
}
 
Example #17
Source File: TreeFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public SerialFieldTree SerialField(com.sun.source.doctree.IdentifierTree name, ReferenceTree type, List<? extends DocTree> description) {
    return docMake.at(NOPOS).newSerialFieldTree(name, type, description);
}
 
Example #18
Source File: ImmutableDocTreeTranslator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public DocTree visitSerialField(SerialFieldTree tree, Object p) {
    return rewriteChildren(tree);
}
 
Example #19
Source File: Checker.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void visitSerialField(SerialFieldTree tree, Void ignore) {
    warnIfEmpty(tree, tree.getDescription());
    return super.visitSerialField(tree, ignore);
}
 
Example #20
Source File: Checker.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void visitSerialField(SerialFieldTree tree, Void ignore) {
    warnIfEmpty(tree, tree.getDescription());
    return super.visitSerialField(tree, ignore);
}
 
Example #21
Source File: DocTreeFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a new {@code SerialFieldTree} object, to represent a {@code @serialField } tag.
 * @param name the name of the field
 * @param type the type of the field
 * @param description the description of the field
 * @return a {@code SerialFieldTree} object
 */
SerialFieldTree newSerialFieldTree(IdentifierTree name, ReferenceTree type, List<? extends DocTree> description);
 
Example #22
Source File: TreeMaker.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**Creates the DocTree's SerialFieldTree.
 * 
 * @param name the name of the field
 * @param type the type of the field
 * @param description the description of the field
 * @return newly created SerialFieldTree
 * @since 0.124
 */
public SerialFieldTree SerialField(com.sun.source.doctree.IdentifierTree name, ReferenceTree type, List<? extends DocTree> description) {
    return delegate.SerialField(name, type, description);
}
 
Example #23
Source File: DocTreeFactory.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Create a new {@code SerialFieldTree} object, to represent a {@code @serialField } tag.
 * @param name the name of the field
 * @param type the type of the field
 * @param description the description of the field
 * @return a {@code SerialFieldTree} object
 */
SerialFieldTree newSerialFieldTree(IdentifierTree name, ReferenceTree type, List<? extends DocTree> description);