- java.lang.Object
-
- java.lang.Enum<SourceVersion>
-
- javax.lang.model.SourceVersion
-
- All Implemented Interfaces:
- Serializable, Comparable<SourceVersion>
public enum SourceVersion extends Enum<SourceVersion>
Source versions of the Java™ programming language. See the appropriate edition of The Java™ Language Specification for information about a particular source version.Note that additional source version constants will be added to model future releases of the language.
- Since:
- 1.6
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description RELEASE_0
The original version.RELEASE_1
The version recognized by the Java Platform 1.1.RELEASE_2
The version recognized by the Java 2 Platform, Standard Edition, v 1.2.RELEASE_3
The version recognized by the Java 2 Platform, Standard Edition, v 1.3.RELEASE_4
The version recognized by the Java 2 Platform, Standard Edition, v 1.4.RELEASE_5
The version recognized by the Java 2 Platform, Standard Edition 5.0.RELEASE_6
The version recognized by the Java Platform, Standard Edition 6.RELEASE_7
The version recognized by the Java Platform, Standard Edition 7.
-
Method Summary
Methods Modifier and Type Method and Description static boolean
isIdentifier(CharSequence name)
Returns whether or notname
is a syntactically valid identifier (simple name) or keyword in the latest source version.static boolean
isKeyword(CharSequence s)
Returns whether or nots
is a keyword or literal in the latest source version.static boolean
isName(CharSequence name)
Returns whether or notname
is a syntactically valid qualified name in the latest source version.static SourceVersion
latest()
Returns the latest source version that can be modeled.static SourceVersion
latestSupported()
Returns the latest source version fully supported by the current execution environment.static SourceVersion
valueOf(String name)
Returns the enum constant of this type with the specified name.static SourceVersion[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
RELEASE_0
public static final SourceVersion RELEASE_0
The original version. The language described in The Java™ Language Specification, First Edition.
-
RELEASE_1
public static final SourceVersion RELEASE_1
The version recognized by the Java Platform 1.1. The language isRELEASE_0
augmented with nested classes as described in the 1.1 update to The Java™ Language Specification, First Edition.
-
RELEASE_2
public static final SourceVersion RELEASE_2
The version recognized by the Java 2 Platform, Standard Edition, v 1.2. The language described in The Java™ Language Specification, Second Edition, which includes thestrictfp
modifier.
-
RELEASE_3
public static final SourceVersion RELEASE_3
The version recognized by the Java 2 Platform, Standard Edition, v 1.3. No major changes fromRELEASE_2
.
-
RELEASE_4
public static final SourceVersion RELEASE_4
The version recognized by the Java 2 Platform, Standard Edition, v 1.4. Added a simple assertion facility.
-
RELEASE_5
public static final SourceVersion RELEASE_5
The version recognized by the Java 2 Platform, Standard Edition 5.0. The language described in The Java™ Language Specification, Third Edition. First release to support generics, annotations, autoboxing, var-args, enhancedfor
loop, and hexadecimal floating-point literals.
-
RELEASE_6
public static final SourceVersion RELEASE_6
The version recognized by the Java Platform, Standard Edition 6. No major changes fromRELEASE_5
.
-
RELEASE_7
public static final SourceVersion RELEASE_7
The version recognized by the Java Platform, Standard Edition 7.- Since:
- 1.7
-
-
Method Detail
-
values
public static SourceVersion[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SourceVersion c : SourceVersion.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SourceVersion valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
latest
public static SourceVersion latest()
Returns the latest source version that can be modeled.- Returns:
- the latest source version that can be modeled
-
latestSupported
public static SourceVersion latestSupported()
Returns the latest source version fully supported by the current execution environment.RELEASE_5
or later must be returned.- Returns:
- the latest source version that is fully supported
-
isIdentifier
public static boolean isIdentifier(CharSequence name)
Returns whether or notname
is a syntactically valid identifier (simple name) or keyword in the latest source version. The method returnstrue
if the name consists of an initial character for whichCharacter.isJavaIdentifierStart(int)
returnstrue
, followed only by characters for whichCharacter.isJavaIdentifierPart(int)
returnstrue
. This pattern matches regular identifiers, keywords, and the literals"true"
,"false"
, and"null"
. The method returnsfalse
for all other strings.- Parameters:
name
- the string to check- Returns:
true
if this string is a syntactically valid identifier or keyword,false
otherwise.
-
isName
public static boolean isName(CharSequence name)
Returns whether or notname
is a syntactically valid qualified name in the latest source version. UnlikeisIdentifier
, this method returnsfalse
for keywords and literals.- Parameters:
name
- the string to check- Returns:
true
if this string is a syntactically valid name,false
otherwise.- See The Java™ Language Specification:
- 6.2 Names and Identifiers
-
isKeyword
public static boolean isKeyword(CharSequence s)
Returns whether or nots
is a keyword or literal in the latest source version.- Parameters:
s
- the string to check- Returns:
true
ifs
is a keyword or literal,false
otherwise.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/lang/model/SourceVersion.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.