public class Modifier
extends Object
java.lang.Object | |
java.lang.reflect.Modifier |
Modifier类提供了static
方法和常量来解码类和成员访问修饰符。 修饰符集表示为整数,其中不同的位位置表示不同的修饰符。 表示修饰符的常量值取自The JavaTM Virtual Machine Specification的第4.1,4.4,4.5和4.7节中的表格 。
也可以看看:
常量(Constants) |
|
---|---|
int |
ABSTRACT 代表 |
int |
FINAL 代表 |
int |
INTERFACE 表示 |
int |
NATIVE 表示 |
int |
PRIVATE 代表 |
int |
PROTECTED 代表 |
int |
PUBLIC 代表 |
int |
STATIC 代表 |
int |
STRICT 代表 |
int |
SYNCHRONIZED 代表 |
int |
TRANSIENT 代表 |
int |
VOLATILE 表示 |
Public constructors |
|
---|---|
Modifier() |
公共方法(Public methods) |
|
---|---|
static int |
classModifiers() 返回一个 |
static int |
constructorModifiers() 返回一个 |
static int |
fieldModifiers() 返回值 |
static int |
interfaceModifiers() 返回 |
static boolean |
isAbstract(int mod) 返回 |
static boolean |
isFinal(int mod) 返回 |
static boolean |
isInterface(int mod) 返回 |
static boolean |
isNative(int mod) 返回 |
static boolean |
isPrivate(int mod) 返回 |
static boolean |
isProtected(int mod) 返回 |
static boolean |
isPublic(int mod) 返回 |
static boolean |
isStatic(int mod) 返回 |
static boolean |
isStrict(int mod) 返回 |
static boolean |
isSynchronized(int mod) 返回 |
static boolean |
isTransient(int mod) 返回 |
static boolean |
isVolatile(int mod) 返回 |
static int |
methodModifiers() 返回值 |
static String |
toString(int mod) 返回描述指定修饰符中访问修饰符标志的字符串。 |
继承方法(Inherited methods) |
|
---|---|
![]() java.lang.Object
|
int classModifiers ()
返回一个 int
值,将可应用于类的源语言修饰符组合在一起。
返回(Returns) | |
---|---|
int |
an int value OR-ing together the source language modifiers that can be applied to a class. |
int constructorModifiers ()
返回值 int
,将可应用于构造函数的源语言修饰符进行OR操作。
返回(Returns) | |
---|---|
int |
an int value OR-ing together the source language modifiers that can be applied to a constructor. |
int fieldModifiers ()
返回一个 int
值,将可应用于某个字段的源语言修饰符组合在一起。
返回(Returns) | |
---|---|
int |
an int value OR-ing together the source language modifiers that can be applied to a field. |
int interfaceModifiers ()
返回一个 int
值,将可应用于接口的源语言修饰符组合在一起。
返回(Returns) | |
---|---|
int |
an int value OR-ing together the source language modifiers that can be applied to an inteface. |
boolean isAbstract (int mod)
返回 true
如果整数参数包括 abstract
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the abstract modifier; false otherwise. |
boolean isFinal (int mod)
返回 true
如果整数参数包括 final
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the final modifier; false otherwise. |
boolean isInterface (int mod)
返回 true
如果整数参数包括 interface
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the interface modifier; false otherwise. |
boolean isNative (int mod)
返回 true
如果整数参数包括 native
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the native modifier; false otherwise. |
boolean isPrivate (int mod)
返回 true
如果整数参数包括 private
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the private modifier; false otherwise. |
boolean isProtected (int mod)
返回 true
如果整数参数包括 protected
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the protected modifier; false otherwise. |
boolean isPublic (int mod)
返回 true
如果整数参数包括 public
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the public modifier; false otherwise. |
boolean isStatic (int mod)
返回 true
如果整数参数包括 static
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the static modifier; false otherwise. |
boolean isStrict (int mod)
返回 true
如果整数参数包括 strictfp
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the strictfp modifier; false otherwise. |
boolean isSynchronized (int mod)
返回 true
如果整数参数包括 synchronized
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the synchronized modifier; false otherwise. |
boolean isTransient (int mod)
返回 true
如果整数参数包括 transient
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the transient modifier; false otherwise. |
boolean isVolatile (int mod)
返回 true
如果整数参数包括 volatile
修改, false
否则。
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
boolean |
true if mod includes the volatile modifier; false otherwise. |
int methodModifiers ()
返回一个 int
值,将可应用于方法的源语言修饰符组合在一起。
返回(Returns) | |
---|---|
int |
an int value OR-ing together the source language modifiers that can be applied to a method. |
String toString (int mod)
返回描述指定修饰符中访问修饰符标志的字符串。 例如:
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 JavaTM 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
The
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 of
toString
with the appropriate mask from a method like
constructorModifiers()
or
methodModifiers()
.
参数(Parameters) | |
---|---|
mod |
int : a set of modifiers |
返回(Returns) | |
---|---|
String |
a string representation of the set of modifiers represented by mod |