com.sun.source.doctree.EntityTree Java Examples

The following examples show how to use com.sun.source.doctree.EntityTree. 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: Checker.java    From jdk8u60 with 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 File: Checker.java    From openjdk-jdk8u with 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 File: Checker.java    From openjdk-8 with 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 #4
Source File: Checker.java    From openjdk-8-source with 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 #5
Source File: Checker.java    From hottub with 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 #6
Source File: Checker.java    From openjdk-jdk9 with 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 #7
Source File: Checker.java    From openjdk-jdk8u-backup with 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 #8
Source File: Checker.java    From TencentKona-8 with 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 #9
Source File: VeryPretty.java    From netbeans with 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 File: JavadocFormatter.java    From openjdk-jdk9 with 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 File: RefactoringVisitor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public DocTree visitEntity(EntityTree node, Element p) {
    return instance.visitEntity(node, p);
}
 
Example #12
Source File: JavadocConverter.java    From j2objc with 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 #13
Source File: Analyzer.java    From netbeans with 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 #14
Source File: RefactoringVisitor.java    From netbeans with 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 #15
Source File: RefactoringVisitor.java    From netbeans with 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 File: TreeFactory.java    From netbeans with 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 #17
Source File: ImmutableDocTreeTranslator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public DocTree visitEntity(EntityTree tree, Object p) {
    return rewriteChildren(tree);
}
 
Example #18
Source File: ImmutableDocTreeTranslator.java    From netbeans with 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 #19
Source File: ApiDoclet.java    From uyuni with 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 #20
Source File: TreeMaker.java    From netbeans with 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 #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 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 #22
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 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);