public enum RetentionPolicy extends Enum<RetentionPolicy>
Retention
元注释类型指定的注释是多长时间保持连接。
Enum Constant and Description |
---|
CLASS
注释将被编译器记录在类文件中,但不需要在运行时由虚拟机保留。
|
RUNTIME
注释要记录在类文件由编译器和运行时虚拟机保留的,所以他们可以读沉思。
|
SOURCE
注释将被编译器丢弃。
|
Modifier and Type | Method and Description |
---|---|
static RetentionPolicy |
valueOf(String name)
返回此类型具有指定名称的枚举常量。
|
static RetentionPolicy[] |
values()
返回一个数组包含该枚举类型的常量,它们的顺序声明。
|
public static final RetentionPolicy SOURCE
public static final RetentionPolicy CLASS
public static final RetentionPolicy RUNTIME
AnnotatedElement
public static RetentionPolicy[] values()
对于(retentionpolicy C:retentionpolicy。values()) 系统,println(C);
public static RetentionPolicy valueOf(String name)
name
-定要返回的枚举的名称。
IllegalArgumentException
-如果这个枚举类型,也没有固定的具有指定名称
NullPointerException
-如果参数为空
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.