Class Modifiers


  • public final class Modifiers
    extends Object
    Utility class for constructing and checking access flags in Java class files.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isAbstract​(int mod)
      Checks if the access flags indicate that the entity is abstract.
      static boolean isAnnotation​(int mod)
      Checks if the access flags indicate that the entity is an annotation.
      static boolean isBridge​(int mod)
      Checks if the access flags indicate that the entity is a bridge method.
      static boolean isEnum​(int mod)
      Checks if the access flags indicate that the entity is an enum.
      static boolean isFinal​(int mod)
      Checks if the access flags indicate that the entity is final.
      static boolean isInterface​(int mod)
      Checks if the access flags indicate that the entity is an interface.
      static boolean isNative​(int mod)
      Checks if the access flags indicate that the entity is native.
      static boolean isPackagePrivate​(int mod)
      Determines if the entity has package-private visibility.
      static boolean isPrivate​(int mod)
      Checks if the access flags indicate that the entity is private.
      static boolean isProtected​(int mod)
      Checks if the access flags indicate that the entity is protected.
      static boolean isPublic​(int mod)
      Checks if the access flags indicate that the entity is public.
      static boolean isStatic​(int mod)
      Checks if the access flags indicate that the entity is static.
      static boolean isStrict​(int mod)
      Checks if the access flags indicate that the entity is strictfp.
      static boolean isSynchronized​(int mod)
      Checks if the access flags indicate that the entity is synchronized.
      static boolean isSynthetic​(int mod)
      Checks if the access flags indicate that the entity is synthetic.
      static boolean isTransient​(int mod)
      Checks if the access flags indicate that the entity is transient.
      static boolean isVarArgs​(int mod)
      Checks if the access flags indicate that the method has variable arguments.
      static boolean isVolatile​(int mod)
      Checks if the access flags indicate that the entity is volatile.
      static int setAbstract​(int mod)
      Sets the abstract access flag.
      static int setAnnotation​(int mod)
      Sets the annotation access flag.
      static int setBridge​(int mod)
      Sets the bridge access flag.
      static int setEnum​(int mod)
      Sets the enum access flag.
      static int setFinal​(int mod)
      Sets the final access flag.
      static int setInterface​(int mod)
      Sets the interface access flag.
      static int setNative​(int mod)
      Sets the native access flag.
      static int setPrivate​(int mod)
      Sets the private access flag.
      static int setProtected​(int mod)
      Sets the protected access flag.
      static int setPublic​(int mod)
      Sets the public access flag.
      static int setStatic​(int mod)
      Sets the static access flag.
      static int setStrict​(int mod)
      Sets the strictfp access flag.
      static int setSynchronized​(int mod)
      Sets the synchronized access flag.
      static int setSynthetic​(int mod)
      Sets the synthetic access flag.
      static int setTransient​(int mod)
      Sets the transient access flag.
      static int setVarArgs​(int mod)
      Sets the varargs access flag.
      static int setVolatile​(int mod)
      Sets the volatile access flag.
      static String toString​(int mod)
      Returns a string describing the access modifier flags in the specified modifier.
    • Method Detail

      • setPublic

        public static int setPublic​(int mod)
        Sets the public access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with public set
      • setPrivate

        public static int setPrivate​(int mod)
        Sets the private access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with private set
      • setProtected

        public static int setProtected​(int mod)
        Sets the protected access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with protected set
      • setStatic

        public static int setStatic​(int mod)
        Sets the static access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with static set
      • setInterface

        public static int setInterface​(int mod)
        Sets the interface access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with interface set
      • setFinal

        public static int setFinal​(int mod)
        Sets the final access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with final set
      • setSynchronized

        public static int setSynchronized​(int mod)
        Sets the synchronized access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with synchronized set
      • setBridge

        public static int setBridge​(int mod)
        Sets the bridge access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with bridge set
      • setVarArgs

        public static int setVarArgs​(int mod)
        Sets the varargs access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with varargs set
      • setNative

        public static int setNative​(int mod)
        Sets the native access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with native set
      • setAbstract

        public static int setAbstract​(int mod)
        Sets the abstract access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with abstract set
      • setStrict

        public static int setStrict​(int mod)
        Sets the strictfp access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with strictfp set
      • setSynthetic

        public static int setSynthetic​(int mod)
        Sets the synthetic access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with synthetic set
      • setAnnotation

        public static int setAnnotation​(int mod)
        Sets the annotation access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with annotation set
      • setEnum

        public static int setEnum​(int mod)
        Sets the enum access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with enum set
      • setVolatile

        public static int setVolatile​(int mod)
        Sets the volatile access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with volatile set
      • setTransient

        public static int setTransient​(int mod)
        Sets the transient access flag.
        Parameters:
        mod - the current access flags
        Returns:
        the updated access flags with transient set
      • isPublic

        public static boolean isPublic​(int mod)
        Checks if the access flags indicate that the entity is public.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the public flag is set, false otherwise
      • isPrivate

        public static boolean isPrivate​(int mod)
        Checks if the access flags indicate that the entity is private.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the private flag is set, false otherwise
      • isProtected

        public static boolean isProtected​(int mod)
        Checks if the access flags indicate that the entity is protected.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the protected flag is set, false otherwise
      • isStatic

        public static boolean isStatic​(int mod)
        Checks if the access flags indicate that the entity is static.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the static flag is set, false otherwise
      • isFinal

        public static boolean isFinal​(int mod)
        Checks if the access flags indicate that the entity is final.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the final flag is set, false otherwise
      • isSynchronized

        public static boolean isSynchronized​(int mod)
        Checks if the access flags indicate that the entity is synchronized.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the synchronized flag is set, false otherwise
      • isBridge

        public static boolean isBridge​(int mod)
        Checks if the access flags indicate that the entity is a bridge method.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the bridge flag is set, false otherwise
      • isVarArgs

        public static boolean isVarArgs​(int mod)
        Checks if the access flags indicate that the method has variable arguments.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the varargs flag is set, false otherwise
      • isNative

        public static boolean isNative​(int mod)
        Checks if the access flags indicate that the entity is native.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the native flag is set, false otherwise
      • isAbstract

        public static boolean isAbstract​(int mod)
        Checks if the access flags indicate that the entity is abstract.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the abstract flag is set, false otherwise
      • isStrict

        public static boolean isStrict​(int mod)
        Checks if the access flags indicate that the entity is strictfp.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the strictfp flag is set, false otherwise
      • isSynthetic

        public static boolean isSynthetic​(int mod)
        Checks if the access flags indicate that the entity is synthetic.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the synthetic flag is set, false otherwise
      • isAnnotation

        public static boolean isAnnotation​(int mod)
        Checks if the access flags indicate that the entity is an annotation.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the annotation flag is set, false otherwise
      • isEnum

        public static boolean isEnum​(int mod)
        Checks if the access flags indicate that the entity is an enum.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the enum flag is set, false otherwise
      • isInterface

        public static boolean isInterface​(int mod)
        Checks if the access flags indicate that the entity is an interface.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the interface flag is set, false otherwise
      • isVolatile

        public static boolean isVolatile​(int mod)
        Checks if the access flags indicate that the entity is volatile.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the volatile flag is set, false otherwise
      • isTransient

        public static boolean isTransient​(int mod)
        Checks if the access flags indicate that the entity is transient.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the transient flag is set, false otherwise
      • isPackagePrivate

        public static boolean isPackagePrivate​(int mod)
        Determines if the entity has package-private visibility.
        Parameters:
        mod - the access flags integer
        Returns:
        true if the entity has package-private visibility, false otherwise
      • toString

        public static String toString​(int mod)
        Returns a string describing the access modifier flags in the specified modifier.
        Parameters:
        mod - modifier flags.
        Returns:
        a string representation of the modifiers