- java.lang.Object
-
- java.lang.reflect.Modifier
-
public class Modifier extends Object
The Modifier class providesstatic
methods and constants to decode class and member access modifiers. The sets of modifiers are represented as integers with distinct bit positions representing different modifiers. The values for the constants representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of The Java™ Virtual Machine Specification.- See Also:
Class.getModifiers()
,Member.getModifiers()
-
-
Field Summary
Fields Modifier and Type Field and Description static int
ABSTRACT
Theint
value representing theabstract
modifier.static int
FINAL
Theint
value representing thefinal
modifier.static int
INTERFACE
Theint
value representing theinterface
modifier.static int
NATIVE
Theint
value representing thenative
modifier.static int
PRIVATE
Theint
value representing theprivate
modifier.static int
PROTECTED
Theint
value representing theprotected
modifier.static int
PUBLIC
Theint
value representing thepublic
modifier.static int
STATIC
Theint
value representing thestatic
modifier.static int
STRICT
Theint
value representing thestrictfp
modifier.static int
SYNCHRONIZED
Theint
value representing thesynchronized
modifier.static int
TRANSIENT
Theint
value representing thetransient
modifier.static int
VOLATILE
Theint
value representing thevolatile
modifier.
-
Constructor Summary
Constructors Constructor and Description Modifier()
-
Method Summary
Methods Modifier and Type Method and Description static int
classModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to a class.static int
constructorModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to a constructor.static int
fieldModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to a field.static int
interfaceModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to an interface.static boolean
isAbstract(int mod)
Returntrue
if the integer argument includes theabstract
modifier,false
otherwise.static boolean
isFinal(int mod)
Returntrue
if the integer argument includes thefinal
modifier,false
otherwise.static boolean
isInterface(int mod)
Returntrue
if the integer argument includes theinterface
modifier,false
otherwise.static boolean
isNative(int mod)
Returntrue
if the integer argument includes thenative
modifier,false
otherwise.static boolean
isPrivate(int mod)
Returntrue
if the integer argument includes theprivate
modifier,false
otherwise.static boolean
isProtected(int mod)
Returntrue
if the integer argument includes theprotected
modifier,false
otherwise.static boolean
isPublic(int mod)
Returntrue
if the integer argument includes thepublic
modifier,false
otherwise.static boolean
isStatic(int mod)
Returntrue
if the integer argument includes thestatic
modifier,false
otherwise.static boolean
isStrict(int mod)
Returntrue
if the integer argument includes thestrictfp
modifier,false
otherwise.static boolean
isSynchronized(int mod)
Returntrue
if the integer argument includes thesynchronized
modifier,false
otherwise.static boolean
isTransient(int mod)
Returntrue
if the integer argument includes thetransient
modifier,false
otherwise.static boolean
isVolatile(int mod)
Returntrue
if the integer argument includes thevolatile
modifier,false
otherwise.static int
methodModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to a method.static String
toString(int mod)
Return a string describing the access modifier flags in the specified modifier.
-
-
-
Field Detail
-
PUBLIC
public static final int PUBLIC
Theint
value representing thepublic
modifier.- See Also:
- Constant Field Values
-
PRIVATE
public static final int PRIVATE
Theint
value representing theprivate
modifier.- See Also:
- Constant Field Values
-
PROTECTED
public static final int PROTECTED
Theint
value representing theprotected
modifier.- See Also:
- Constant Field Values
-
STATIC
public static final int STATIC
Theint
value representing thestatic
modifier.- See Also:
- Constant Field Values
-
FINAL
public static final int FINAL
Theint
value representing thefinal
modifier.- See Also:
- Constant Field Values
-
SYNCHRONIZED
public static final int SYNCHRONIZED
Theint
value representing thesynchronized
modifier.- See Also:
- Constant Field Values
-
VOLATILE
public static final int VOLATILE
Theint
value representing thevolatile
modifier.- See Also:
- Constant Field Values
-
TRANSIENT
public static final int TRANSIENT
Theint
value representing thetransient
modifier.- See Also:
- Constant Field Values
-
NATIVE
public static final int NATIVE
Theint
value representing thenative
modifier.- See Also:
- Constant Field Values
-
INTERFACE
public static final int INTERFACE
Theint
value representing theinterface
modifier.- See Also:
- Constant Field Values
-
ABSTRACT
public static final int ABSTRACT
Theint
value representing theabstract
modifier.- See Also:
- Constant Field Values
-
STRICT
public static final int STRICT
Theint
value representing thestrictfp
modifier.- See Also:
- Constant Field Values
-
-
Method Detail
-
isPublic
public static boolean isPublic(int mod)
Returntrue
if the integer argument includes thepublic
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes thepublic
modifier;false
otherwise.
-
isPrivate
public static boolean isPrivate(int mod)
Returntrue
if the integer argument includes theprivate
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes theprivate
modifier;false
otherwise.
-
isProtected
public static boolean isProtected(int mod)
Returntrue
if the integer argument includes theprotected
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes theprotected
modifier;false
otherwise.
-
isStatic
public static boolean isStatic(int mod)
Returntrue
if the integer argument includes thestatic
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes thestatic
modifier;false
otherwise.
-
isFinal
public static boolean isFinal(int mod)
Returntrue
if the integer argument includes thefinal
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes thefinal
modifier;false
otherwise.
-
isSynchronized
public static boolean isSynchronized(int mod)
Returntrue
if the integer argument includes thesynchronized
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes thesynchronized
modifier;false
otherwise.
-
isVolatile
public static boolean isVolatile(int mod)
Returntrue
if the integer argument includes thevolatile
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes thevolatile
modifier;false
otherwise.
-
isTransient
public static boolean isTransient(int mod)
Returntrue
if the integer argument includes thetransient
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes thetransient
modifier;false
otherwise.
-
isNative
public static boolean isNative(int mod)
Returntrue
if the integer argument includes thenative
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes thenative
modifier;false
otherwise.
-
isInterface
public static boolean isInterface(int mod)
Returntrue
if the integer argument includes theinterface
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes theinterface
modifier;false
otherwise.
-
isAbstract
public static boolean isAbstract(int mod)
Returntrue
if the integer argument includes theabstract
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes theabstract
modifier;false
otherwise.
-
isStrict
public static boolean isStrict(int mod)
Returntrue
if the integer argument includes thestrictfp
modifier,false
otherwise.- Parameters:
mod
- a set of modifiers- Returns:
true
ifmod
includes thestrictfp
modifier;false
otherwise.
-
toString
public static String toString(int mod)
Return a string describing the access modifier flags in the specified modifier. For example:
The modifier names are returned in an order consistent with the suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of The Java™ Language Specification. The full modifier ordering used by this method is:public final synchronized strictfp
public protected private abstract static final transient volatile synchronized native strictfp interface
interface
modifier discussed in this class is not a true modifier in the Java language and it appears after all other modifiers listed by this method. This method may return a string of modifiers that are not valid modifiers of a Java entity; in other words, no checking is done on the possible validity of the combination of modifiers represented by the input. Note that to perform such checking for a known kind of entity, such as a constructor or method, first AND the argument oftoString
with the appropriate mask from a method likeconstructorModifiers()
ormethodModifiers()
.- Parameters:
mod
- a set of modifiers- Returns:
- a string representation of the set of modifiers
represented by
mod
-
classModifiers
public static int classModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to a class.- Returns:
- an
int
value OR-ing together the source language modifiers that can be applied to a class. - Since:
- 1.7
- See The Java™ Language Specification:
- 8.1.1 Class Modifiers
-
interfaceModifiers
public static int interfaceModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to an interface.- Returns:
- an
int
value OR-ing together the source language modifiers that can be applied to an inteface. - Since:
- 1.7
- See The Java™ Language Specification:
- 9.1.1 Interface Modifiers
-
constructorModifiers
public static int constructorModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to a constructor.- Returns:
- an
int
value OR-ing together the source language modifiers that can be applied to a constructor. - Since:
- 1.7
- See The Java™ Language Specification:
- 8.8.3 Constructor Modifiers
-
methodModifiers
public static int methodModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to a method.- Returns:
- an
int
value OR-ing together the source language modifiers that can be applied to a method. - Since:
- 1.7
- See The Java™ Language Specification:
- 8.4.3 Method Modifiers
-
fieldModifiers
public static int fieldModifiers()
Return anint
value OR-ing together the source language modifiers that can be applied to a field.- Returns:
- an
int
value OR-ing together the source language modifiers that can be applied to a field. - Since:
- 1.7
- See The Java™ Language Specification:
- 8.3.1 Field Modifiers
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-java/lang/reflect/Modifier.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.