java.lang.reflect – Modifier


java.lang.reflect – Modifier Class


”;


Introduction

The java.lang.reflect.Modifier class provides static 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.

Class declaration

Following is the declaration for java.lang.reflect.Modifier class −

public class Modifier
   extends Object

Fields

Following are the fields for java.lang.reflect.Modifier class −

  • static int ABSTRACT − The int value representing the abstract modifier.

  • static int FINAL − The int value representing the final modifier.

  • static int INTERFACE − The int value representing the interface modifier.

  • static int NATIVE − The int value representing the native modifier.

  • static int PRIVATE − The int value representing the private modifier.

  • static int PROTECTED − The int value representing the protected modifier.

  • static int PUBLIC − The int value representing the public modifier.

  • static int STATIC − The int value representing the static modifier.

  • static int STRICT − The int value representing the strictfp modifier.

  • static int SYNCHRONIZED − The int value representing the synchronized modifier.

  • static int TRANSIENT − The int value representing the transient modifier.

  • static int VOLATILE − The int value representing the volatile modifier.

Constructors

Sr.No. Constructor & Description
1 Modifier()

Default Constructor.

Class methods

Sr.No. Method & Description
1 static int classModifiers()

Return an int value OR-ing together the source language modifiers that can be applied to a class.

2 static int constructorModifiers()

Return an int value OR-ing together the source language modifiers that can be applied to a constructor.

3 static int fieldModifiers()

Return an int value OR-ing together the source language modifiers that can be applied to a field.

4 static int interfaceModifiers()

Return an int value OR-ing together the source language modifiers that can be applied to an interface.

5 static boolean isAbstract(int mod)

Return true if the integer argument includes the abstract modifier, false otherwise.

6 static boolean isFinal(int mod)

Return true if the integer argument includes the final modifier, false otherwise.

7 static boolean isInterface(int mod)

Return true if the integer argument includes the interface modifier, false otherwise.

8 static boolean isNative(int mod)

Return true if the integer argument includes the native modifier, false otherwise.

9 static boolean isPrivate(int mod)

Return true if the integer argument includes the private modifier, false otherwise.

10 static boolean isProtected(int mod)

Return true if the integer argument includes the protected modifier, false otherwise.

11 static boolean isPublic(int mod)

Return true if the integer argument includes the public modifier, false otherwise.

12 static boolean isStatic(int mod)

Return true if the integer argument includes the static modifier, false otherwise.

13 static boolean isStrict(int mod)

Return true if the integer argument includes the strictfp modifier, false otherwise.

14 static boolean isSynchronized(int mod)

Return true if the integer argument includes the synchronized modifier, false otherwise.

15 static boolean isTransient(int mod)

Return true if the integer argument includes the transient modifier, false otherwise.

16 static boolean isVolatile(int mod)

Return true if the integer argument includes the volatile modifier, false otherwise.

17 static int methodModifiers()

Return an int value OR-ing together the source language modifiers that can be applied to a method.

18 static String toString(int mod)

Return a string describing the access modifier flags in the specified modifier.

Methods inherited

This class inherits methods from the following classes −

  • java.lang.Object

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *