Java Code Examples for com.sun.source.doctree.EntityTree

The following examples show how to use com.sun.source.doctree.EntityTree. These examples are extracted from open source projects. 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 Project: TencentKona-8   Author: Tencent   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = StringUtils.toLowerCase(name).startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #2
Source Project: jdk8u60   Author: chenghanpeng   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = StringUtils.toLowerCase(name).startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #3
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = StringUtils.toLowerCase(name).startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #4
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = StringUtils.toLowerCase(name).startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #5
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = StringUtils.toLowerCase(name).startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #6
Source Project: hottub   Author: dsrg-uoft   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = StringUtils.toLowerCase(name).startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #7
Source Project: openjdk-8-source   Author: keerath   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = name.toLowerCase().startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #8
Source Project: openjdk-8   Author: bpupadhyaya   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = name.toLowerCase().startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #9
Source Project: netbeans   Author: apache   File: VeryPretty.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Void visitEntity(EntityTree node, Void p) {
    print("&");
    print(node.getName());
    print(";");
    return null;
}
 
Example #10
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: JavadocFormatter.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public Object visitEntity(EntityTree node, Object p) {
    String name = node.getName().toString();
    int code = -1;
    if (name.startsWith("#")) {
        try {
            int v = StringUtils.toLowerCase(name).startsWith("#x")
                    ? Integer.parseInt(name.substring(2), 16)
                    : Integer.parseInt(name.substring(1), 10);
            if (Entity.isValid(v)) {
                code = v;
            }
        } catch (NumberFormatException ex) {
            //ignore
        }
    } else {
        Entity entity = Entity.get(name);
        if (entity != null) {
            code = entity.code;
        }
    }
    if (code != (-1)) {
        result.appendCodePoint(code);
    } else {
        result.append(node.toString());
    }
    return super.visitEntity(node, p);
}
 
Example #11
Source Project: uyuni   Author: uyuni-project   File: ApiDoclet.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public String visitEntity(EntityTree node, Void p) {
    return "&" + node.getName().toString() + ";";
}
 
Example #12
Source Project: netbeans   Author: apache   File: ImmutableDocTreeTranslator.java    License: Apache License 2.0 4 votes vote down vote up
protected final EntityTree rewriteChildren(EntityTree tree) {
    return tree; // Nothing to do for a string
}
 
Example #13
Source Project: netbeans   Author: apache   File: ImmutableDocTreeTranslator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public DocTree visitEntity(EntityTree tree, Object p) {
    return rewriteChildren(tree);
}
 
Example #14
Source Project: netbeans   Author: apache   File: TreeFactory.java    License: Apache License 2.0 4 votes vote down vote up
public EntityTree Entity(CharSequence name) {
    return docMake.at(NOPOS).newEntityTree(names.fromString(name.toString()));
}
 
Example #15
Source Project: netbeans   Author: apache   File: RefactoringVisitor.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * @since 1.47
 */
@Override
public DocTree visitEntity(EntityTree node, Element p) {
    return docScanner.visitEntity(node, p, null);
}
 
Example #16
Source Project: netbeans   Author: apache   File: RefactoringVisitor.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public DocTree visitEntity(EntityTree node, Element p) {
    return instance.visitEntity(node, p);
}
 
Example #17
Source Project: netbeans   Author: apache   File: RefactoringVisitor.java    License: Apache License 2.0 4 votes vote down vote up
public DocTree visitEntity(EntityTree node, Element p, Void ignore) {
    return super.visitEntity(node, p);
}
 
Example #18
Source Project: netbeans   Author: apache   File: Analyzer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Void visitEntity(EntityTree node, List<ErrorDescription> errors) {
    return super.visitEntity(node, errors);
}
 
Example #19
Source Project: j2objc   Author: google   File: JavadocConverter.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Void visitEntity(EntityTree node, TagElement tag) {
  String text = String.format("&%s;", node.getName().toString());
  tag.addFragment(setPos(node, new TextElement().setText(text)));
  return null;
}
 
Example #20
Source Project: lua-for-android   Author: qtiuto   File: DocTreeFactory.java    License: BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Create a new {@code EntityTree} object, to represent an HTML entity.
 * @param name the name of the entity, representing the characters between '&lt;' and ';'
 * in the representation of the entity in an HTML document
 * @return an {@code EntityTree} object
 */
EntityTree newEntityTree(Name name);
 
Example #21
Source Project: netbeans   Author: apache   File: TreeMaker.java    License: Apache License 2.0 2 votes vote down vote up
/**Creates the DocTree's HTML EntityTree.
 * 
 * @param name entity name/code
 * @return newly created EntityTree
 * @since 0.124
 */
public EntityTree Entity(CharSequence name) {
    return delegate.Entity(name);
}
 
Example #22
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: DocTreeFactory.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a new {@code EntityTree} object, to represent an HTML entity.
 * @param name the name of the entity, representing the characters between '&lt;' and ';'
 * in the representation of the entity in an HTML document
 * @return an {@code EntityTree} object
 */
EntityTree newEntityTree(Name name);