Enum AccessModifier

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<AccessModifier>

    public enum AccessModifier
    extends java.lang.Enum<AccessModifier>
    This enum represents access modifiers. Access modifiers names are taken from JLS: https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.6
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      PACKAGE
      Package access modifier.
      PRIVATE
      Private access modifier.
      PROTECTED
      Protected access modifier.
      PUBLIC
      Public access modifier.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private AccessModifier()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static AccessModifier getInstance​(java.lang.String modifierName)
      Factory method which returns an AccessModifier instance that corresponds to the given access modifier name represented as a String.
      java.lang.String getName()  
      java.lang.String toString()  
      static AccessModifier valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static AccessModifier[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • PUBLIC

        public static final AccessModifier PUBLIC
        Public access modifier.
      • PROTECTED

        public static final AccessModifier PROTECTED
        Protected access modifier.
      • PACKAGE

        public static final AccessModifier PACKAGE
        Package access modifier.
      • PRIVATE

        public static final AccessModifier PRIVATE
        Private access modifier.
    • Constructor Detail

      • AccessModifier

        private AccessModifier()
    • Method Detail

      • values

        public static AccessModifier[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (AccessModifier c : AccessModifier.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static AccessModifier valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<AccessModifier>
      • getName

        public java.lang.String getName()
      • getInstance

        public static AccessModifier getInstance​(java.lang.String modifierName)
        Factory method which returns an AccessModifier instance that corresponds to the given access modifier name represented as a String. The access modifier name can be formatted both as lower case or upper case string. For example, passing PACKAGE or package as a modifier name will return PACKAGE.
        Parameters:
        modifierName - access modifier name represented as a String.
        Returns:
        the AccessModifier associated with given access modifier name.