本文整理汇总了Java中com.sun.source.doctree.AttributeTree.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeTree.getValue方法的具体用法?Java AttributeTree.getValue怎么用?Java AttributeTree.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.source.doctree.AttributeTree
的用法示例。
在下文中一共展示了AttributeTree.getValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rewriteChildren
import com.sun.source.doctree.AttributeTree; //导入方法依赖的package包/类
protected final AttributeTree rewriteChildren(AttributeTree tree) {
AttributeTree value = tree;
List<? extends DocTree> vl = translateDoc(tree.getValue());
if (vl != tree.getValue()) {
value = make.Attribute((Name) tree.getName(), tree.getValueKind(), vl);
}
return value;
}
示例2: visitAttribute
import com.sun.source.doctree.AttributeTree; //导入方法依赖的package包/类
@Override
public Void visitAttribute(AttributeTree node, Void p) {
print(node.getName());
String quote;
switch (node.getValueKind()) {
case EMPTY:
return null;
case UNQUOTED:
quote = "";
break;
case SINGLE:
quote = "'";
break;
case DOUBLE:
quote = "\"";
break;
default:
throw new AssertionError();
}
print("=");
print(quote);
for (DocTree docTree : node.getValue()) {
doAccept((DCTree)docTree);
}
print(quote);
return null;
}
示例3: getAttrValue
import com.sun.source.doctree.AttributeTree; //导入方法依赖的package包/类
private String getAttrValue(AttributeTree tree) {
if (tree.getValue() == null)
return null;
StringWriter sw = new StringWriter();
try {
new DocPretty(sw).print(tree.getValue());
} catch (IOException e) {
// cannot happen
}
// ignore potential use of entities for now
return sw.toString();
}
示例4: visitAttribute
import com.sun.source.doctree.AttributeTree; //导入方法依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitAttribute(AttributeTree tree, Consumer<DocTreePath> f) {
String name = tree.getName().toString().toLowerCase(Locale.ENGLISH);
switch (name) {
// See https://www.w3.org/TR/html-markup/global-attributes.html#common.attrs.event-handler
case "onabort": case "onblur": case "oncanplay": case "oncanplaythrough":
case "onchange": case "onclick": case "oncontextmenu": case "ondblclick":
case "ondrag": case "ondragend": case "ondragenter": case "ondragleave":
case "ondragover": case "ondragstart": case "ondrop": case "ondurationchange":
case "onemptied": case "onended": case "onerror": case "onfocus": case "oninput":
case "oninvalid": case "onkeydown": case "onkeypress": case "onkeyup":
case "onload": case "onloadeddata": case "onloadedmetadata": case "onloadstart":
case "onmousedown": case "onmousemove": case "onmouseout": case "onmouseover":
case "onmouseup": case "onmousewheel": case "onpause": case "onplay":
case "onplaying": case "onprogress": case "onratechange": case "onreadystatechange":
case "onreset": case "onscroll": case "onseeked": case "onseeking":
case "onselect": case "onshow": case "onstalled": case "onsubmit": case "onsuspend":
case "ontimeupdate": case "onvolumechange": case "onwaiting":
// See https://www.w3.org/TR/html4/sgml/dtd.html
// Most of the attributes that take a %Script are also defined as event handlers
// in HTML 5. The one exception is onunload.
// case "onchange": case "onclick": case "ondblclick": case "onfocus":
// case "onkeydown": case "onkeypress": case "onkeyup": case "onload":
// case "onmousedown": case "onmousemove": case "onmouseout": case "onmouseover":
// case "onmouseup": case "onreset": case "onselect": case "onsubmit":
case "onunload":
f.accept(getCurrentPath());
break;
// See https://www.w3.org/TR/html4/sgml/dtd.html
// https://www.w3.org/TR/html5/
// These are all the attributes that take a %URI or a valid URL potentially surrounded
// by spaces
case "action": case "cite": case "classid": case "codebase": case "data":
case "datasrc": case "for": case "href": case "longdesc": case "profile":
case "src": case "usemap":
List<? extends DocTree> value = tree.getValue();
if (value != null && !value.isEmpty() && value.get(0).getKind() == Kind.TEXT) {
String v = value.get(0).toString().trim().toLowerCase(Locale.ENGLISH);
if (v.startsWith("javascript:")) {
f.accept(getCurrentPath());
}
}
break;
}
return super.visitAttribute(tree, f);
}