Class Modifier

java.lang.Object
java.lang.reflect.Modifier

public class Modifier
extends Object
This class provides static methods to decode class and member modifiers.
See Also:
Class.getModifiers(), Member.getModifiers()
  • Field Summary

    Fields
    Modifier and Type Field Description
    static int ABSTRACT
    The int value representing the abstract modifier.
    static int CONSTRUCTOR
    Dex addition to mark instance constructors and static class initializer methods.
    static int FINAL
    The int value representing the final modifier.
    static int INTERFACE
    The int value representing the interface modifier.
    static int MIRANDA
    Miranda methods are fabrications to reserve virtual method table slots in abstract classes that implement interfaces without declaring the abstract methods that the interface would require they implement.
    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 SYNTHETIC  
    static int TRANSIENT
    The int value representing the transient modifier.
    static int VOLATILE
    The int value representing the volatile modifier.
  • Constructor Summary

    Constructors
    Constructor Description
    Modifier()
    Constructs a new Modifier instance.
  • Method Summary

    Modifier and Type Method Description
    static int classModifiers()
    Returns a mask of all the modifiers that may be applied to classes.
    static int constructorModifiers()
    Returns a mask of all the modifiers that may be applied to constructors.
    static int fieldModifiers()
    Returns a mask of all the modifiers that may be applied to fields.
    static int interfaceModifiers()
    Returns a mask of all the modifiers that may be applied to interfaces.
    static boolean isAbstract​(int modifiers)
    Returns true if the given modifiers contain ABSTRACT.
    static boolean isConstructor​(int modifiers)
    Returns true if the given modifiers contain CONSTRUCTOR.
    static boolean isFinal​(int modifiers)
    Returns true if the given modifiers contain FINAL.
    static boolean isInterface​(int modifiers)
    Returns true if the given modifiers contain INTERFACE.
    static boolean isNative​(int modifiers)
    Returns true if the given modifiers contain NATIVE.
    static boolean isPrivate​(int modifiers)
    Returns true if the given modifiers contain PRIVATE.
    static boolean isProtected​(int modifiers)
    Returns true if the given modifiers contain PROTECTED.
    static boolean isPublic​(int modifiers)
    Returns true if the given modifiers contain PUBLIC.
    static boolean isStatic​(int modifiers)
    Returns true if the given modifiers contain STATIC.
    static boolean isStrict​(int modifiers)
    Returns true if the given modifiers contain STRICT.
    static boolean isSynchronized​(int modifiers)
    Returns true if the given modifiers contain SYNCHRONIZED.
    static boolean isTransient​(int modifiers)
    Returns true if the given modifiers contain TRANSIENT.
    static boolean isVolatile​(int modifiers)
    Returns true if the given modifiers contain VOLATILE.
    static int methodModifiers()
    Returns a mask of all the modifiers that may be applied to methods.
    static String toString​(int modifiers)
    Returns a string containing the string representation of all modifiers present in the specified modifiers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PUBLIC

      public static final int PUBLIC
      The int value representing the public modifier.
      See Also:
      Constant Field Values
    • PRIVATE

      public static final int PRIVATE
      The int value representing the private modifier.
      See Also:
      Constant Field Values
    • PROTECTED

      public static final int PROTECTED
      The int value representing the protected modifier.
      See Also:
      Constant Field Values
    • STATIC

      public static final int STATIC
      The int value representing the static modifier.
      See Also:
      Constant Field Values
    • FINAL

      public static final int FINAL
      The int value representing the final modifier.
      See Also:
      Constant Field Values
    • SYNCHRONIZED

      public static final int SYNCHRONIZED
      The int value representing the synchronized modifier.
      See Also:
      Constant Field Values
    • VOLATILE

      public static final int VOLATILE
      The int value representing the volatile modifier.
      See Also:
      Constant Field Values
    • TRANSIENT

      public static final int TRANSIENT
      The int value representing the transient modifier.
      See Also:
      Constant Field Values
    • NATIVE

      public static final int NATIVE
      The int value representing the native modifier.
      See Also:
      Constant Field Values
    • INTERFACE

      public static final int INTERFACE
      The int value representing the interface modifier.
      See Also:
      Constant Field Values
    • ABSTRACT

      public static final int ABSTRACT
      The int value representing the abstract modifier.
      See Also:
      Constant Field Values
    • STRICT

      public static final int STRICT
      The int value representing the strictfp modifier.
      See Also:
      Constant Field Values
    • SYNTHETIC

      public static final int SYNTHETIC
      See Also:
      Constant Field Values
    • MIRANDA

      public static final int MIRANDA
      Miranda methods are fabrications to reserve virtual method table slots in abstract classes that implement interfaces without declaring the abstract methods that the interface would require they implement.
      See Also:
      Constant Field Values
    • CONSTRUCTOR

      public static final int CONSTRUCTOR
      Dex addition to mark instance constructors and static class initializer methods.
      See Also:
      Constant Field Values
  • Constructor Details

    • Modifier

      public Modifier()
      Constructs a new Modifier instance.
  • Method Details

    • classModifiers

      public static int classModifiers()
      Returns a mask of all the modifiers that may be applied to classes.
      Since:
      1.7
    • constructorModifiers

      public static int constructorModifiers()
      Returns a mask of all the modifiers that may be applied to constructors.
      Since:
      1.7
    • fieldModifiers

      public static int fieldModifiers()
      Returns a mask of all the modifiers that may be applied to fields.
      Since:
      1.7
    • interfaceModifiers

      public static int interfaceModifiers()
      Returns a mask of all the modifiers that may be applied to interfaces.
      Since:
      1.7
    • methodModifiers

      public static int methodModifiers()
      Returns a mask of all the modifiers that may be applied to methods.
      Since:
      1.7
    • isAbstract

      public static boolean isAbstract​(int modifiers)
      Returns true if the given modifiers contain ABSTRACT.
    • isFinal

      public static boolean isFinal​(int modifiers)
      Returns true if the given modifiers contain FINAL.
    • isInterface

      public static boolean isInterface​(int modifiers)
      Returns true if the given modifiers contain INTERFACE.
    • isNative

      public static boolean isNative​(int modifiers)
      Returns true if the given modifiers contain NATIVE.
    • isPrivate

      public static boolean isPrivate​(int modifiers)
      Returns true if the given modifiers contain PRIVATE.
    • isProtected

      public static boolean isProtected​(int modifiers)
      Returns true if the given modifiers contain PROTECTED.
    • isPublic

      public static boolean isPublic​(int modifiers)
      Returns true if the given modifiers contain PUBLIC.
    • isStatic

      public static boolean isStatic​(int modifiers)
      Returns true if the given modifiers contain STATIC.
    • isStrict

      public static boolean isStrict​(int modifiers)
      Returns true if the given modifiers contain STRICT.
    • isSynchronized

      public static boolean isSynchronized​(int modifiers)
      Returns true if the given modifiers contain SYNCHRONIZED.
    • isTransient

      public static boolean isTransient​(int modifiers)
      Returns true if the given modifiers contain TRANSIENT.
    • isVolatile

      public static boolean isVolatile​(int modifiers)
      Returns true if the given modifiers contain VOLATILE.
    • isConstructor

      public static boolean isConstructor​(int modifiers)
      Returns true if the given modifiers contain CONSTRUCTOR.
    • toString

      public static String toString​(int modifiers)
      Returns a string containing the string representation of all modifiers present in the specified modifiers. Modifiers appear in the order specified by the Java Language Specification.