R - 这个访问者的方法的返回类型。
对不需要返回结果的访问者使用Void 。
P - 访问者方法的附加参数的类型。
对不需要Void的访问者使用Void。
@SupportedSourceVersion(value=RELEASE_8) public class SimpleElementVisitor8<R,P> extends SimpleElementVisitor7<R,P>
RELEASE_8源版本。
访问方法对应于RELEASE_7和较早的语言结构,调用defaultAction ,将其参数传递给defaultAction的相应参数。
本课程中的方法可能会因其总体合同而被覆盖。 需要注意的是注释方法,具体子类与@Override将有助于确定那些打算重写的方法。
警告: ElementVisitor实现的ElementVisitor接口可能会在以后添加方法,以适应未来版本的Java编程语言中添加的新的,当前未知的语言结构。 因此, "visit"可以将名称以"visit"开头的方法添加到该类中; 为了避免不兼容,扩展此类的类不应声明任何以"visit"实例方法。
当添加这种新的访问方法时,此类中的默认实现将是调用visitUnknown方法。 还将引入一个新的简单元素访问者类来对应于新的语言级别; 该访问者对于访问方法将具有不同的默认行为。 当新访客被介绍时,全部或部分访问者可能会被弃用。
请注意,在访问者类中添加新的访问方法的默认实现将发生,而不是直接在访问者界面中添加默认方法 ,因为Java SE 8语言功能不能用于此版本的API,因为此版本需要可以在Java SE 7实现中运行。 仅在Java SE 8及更高版本上运行的API的未来版本可能会在这种情况下利用默认方法。
SimpleElementVisitor6 , SimpleElementVisitor7
DEFAULT_VALUE| Modifier | Constructor and Description |
|---|---|
protected |
SimpleElementVisitor8()
具体子类的构造方法
使用 null作为默认值。
|
protected |
SimpleElementVisitor8(R defaultValue)
具体子类的构造方法
使用参数作为默认值。
|
visitVariabledefaultAction, visitExecutable, visitPackage, visitType, visitTypeParametervisit, visit, visitUnknownprotected SimpleElementVisitor8()
null作为默认值。
protected SimpleElementVisitor8(R defaultValue)
defaultValue - 要分配给
SimpleElementVisitor6.DEFAULT_VALUE的值
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.