枚举类的使用
javax.lang.model.SourceVersion
使用 SourceVersion 的包
包
描述
用于声明注解处理器和允许注解处理器与注释处理工具环境进行通信的工具。
包的类型和层次结构包含 Java 语言模型、Java 编程语言的声明和类型模型。
为可以从程序中调用的工具提供接口,例如编译器。
Doclet API 提供了一个环境,结合语言模型 API 和编译器树 API,允许客户端检查程序和库的源代码级结构,包括嵌入在源代码中的 API 注解。
-
SourceVersion 在 javax.annotation.processing 中的用法
修饰符和类型方法描述ProcessingEnvironment.getSourceVersion()AbstractProcessor.getSupportedSourceVersion()如果处理器类用SupportedSourceVersion注释,则在注释中返回源版本。Processor.getSupportedSourceVersion()返回此注解处理器支持的最新源版本。 -
SourceVersion 在 javax.lang.model 中的用法
javax.lang.model 中返回 SourceVersion 的方法修饰符和类型方法描述static SourceVersionSourceVersion.latest()返回可以建模的最新源版本。static SourceVersionSourceVersion.latestSupported()返回当前执行环境完全支持的最新源版本。static SourceVersionSourceVersion.valueOf(Runtime.Version rv) 返回在运行时版本参数下可用的最新源版本。static SourceVersion返回具有指定名称的此类的枚举常量。static SourceVersion[]SourceVersion.values()返回一个数组,其中包含此枚举类的常量,按照它们声明的顺序排列。javax.lang.model 中的方法,参数类型为 SourceVersion修饰符和类型方法描述static booleanSourceVersion.isKeyword(CharSequence s, SourceVersion version) 返回s是否为给定源版本中的关键字、布尔文字或空文字。static booleanSourceVersion.isName(CharSequence name, SourceVersion version) 返回name是否是给定源版本中语法上有效的限定名称。 -
SourceVersion 在 javax.tools 中的用法
返回类型中包含 SourceVersion 类型参数的 javax.tools 中的方法 -
SourceVersion 在 jdk.javadoc.doclet 中的用法
jdk.javadoc.doclet 中返回 SourceVersion 的方法修饰符和类型方法描述DocletEnvironment.getSourceVersion()返回读取的源文件的源版本。Doclet.getSupportedSourceVersion()返回此 doclet 支持的 Java 编程语言的版本。StandardDoclet.getSupportedSourceVersion()