Enum Visibility
- java.lang.Object
-
- java.lang.Enum<Visibility>
-
- net.bytebuddy.description.modifier.Visibility
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Visibility>
,ModifierContributor
,ModifierContributor.ForField
,ModifierContributor.ForMethod
,ModifierContributor.ForType
public enum Visibility extends java.lang.Enum<Visibility> implements ModifierContributor.ForType, ModifierContributor.ForMethod, ModifierContributor.ForField
Describes a type's, field's or a method's visibility.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.modifier.ModifierContributor
ModifierContributor.ForField, ModifierContributor.ForMethod, ModifierContributor.ForParameter, ModifierContributor.ForType, ModifierContributor.Resolver<T extends ModifierContributor>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description PACKAGE_PRIVATE
Modifier for a package-private visibility.PRIVATE
A modifier contributor forprivate
visibility.PROTECTED
A modifier contributor forprotected
visibility.PUBLIC
A modifier contributor forpublic
visibility.
-
Field Summary
Fields Modifier and Type Field Description private int
mask
The mask the modifier contributor.-
Fields inherited from interface net.bytebuddy.description.modifier.ModifierContributor
EMPTY_MASK
-
Fields inherited from interface net.bytebuddy.description.modifier.ModifierContributor.ForField
MASK
-
Fields inherited from interface net.bytebuddy.description.modifier.ModifierContributor.ForMethod
MASK
-
Fields inherited from interface net.bytebuddy.description.modifier.ModifierContributor.ForType
MASK
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Visibility(int mask)
Creates a new visibility representation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Visibility
expandTo(Visibility visibility)
Expands the visibility to be at least as high as this visibility and the provided visibility.int
getMask()
Returns the mask of this modifier.int
getRange()
Returns the entire range of modifiers that address this contributor's property.boolean
isDefault()
Determines if this is the default modifier.boolean
isPackagePrivate()
Returnstrue
if this instance describes package-private visibility.boolean
isPrivate()
Returnstrue
if this instance describesprivate
visibility.boolean
isProtected()
Returnstrue
if this instance describesprotected
visibility.boolean
isPublic()
Returnstrue
if this instance describespublic
visibility.static Visibility
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Visibility[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PUBLIC
public static final Visibility PUBLIC
A modifier contributor forpublic
visibility.
-
PACKAGE_PRIVATE
public static final Visibility PACKAGE_PRIVATE
Modifier for a package-private visibility. (This is the default modifier.)
-
PROTECTED
public static final Visibility PROTECTED
A modifier contributor forprotected
visibility.
-
PRIVATE
public static final Visibility PRIVATE
A modifier contributor forprivate
visibility.
-
-
Method Detail
-
values
public static Visibility[] 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 (Visibility c : Visibility.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Visibility 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 namejava.lang.NullPointerException
- if the argument is null
-
getMask
public int getMask()
Returns the mask of this modifier.- Specified by:
getMask
in interfaceModifierContributor
- Returns:
- The modifier mask that is to be applied to the target type or type member.
-
getRange
public int getRange()
Returns the entire range of modifiers that address this contributor's property.- Specified by:
getRange
in interfaceModifierContributor
- Returns:
- The range of this contributor's property.
-
isDefault
public boolean isDefault()
Determines if this is the default modifier.- Specified by:
isDefault
in interfaceModifierContributor
- Returns:
true
if this contributor represents the default modifier.
-
isPublic
public boolean isPublic()
Returnstrue
if this instance describespublic
visibility.- Returns:
true
if this instance describespublic
visibility.
-
isProtected
public boolean isProtected()
Returnstrue
if this instance describesprotected
visibility.- Returns:
true
if this instance describesprotected
visibility.
-
isPackagePrivate
public boolean isPackagePrivate()
Returnstrue
if this instance describes package-private visibility.- Returns:
true
if this instance describes package-private visibility.
-
isPrivate
public boolean isPrivate()
Returnstrue
if this instance describesprivate
visibility.- Returns:
true
if this instance describesprivate
visibility.
-
expandTo
public Visibility expandTo(Visibility visibility)
Expands the visibility to be at least as high as this visibility and the provided visibility.- Parameters:
visibility
- A visibility to compare against.- Returns:
- A visibility that is as least as high as this and the supplied visibility.
-
-