Package org.apache.juneau
Enum Visibility
- All Implemented Interfaces:
Serializable
,Comparable<Visibility>
,java.lang.constant.Constable
Defines class/field/method visibilities.
Used to specify minimum levels of visibility when detecting bean classes, methods, and fields.
Used in conjunction with the following bean context properties:
BeanContext.Builder.beanConstructorVisibility(Visibility)
BeanContext.Builder.beanClassVisibility(Visibility)
BeanContext.Builder.beanFieldVisibility(Visibility)
BeanContext.Builder.beanMethodVisibility(Visibility)
See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isVisible
(int mod) Identifies if the specified mod matches this visibility.boolean
Shortcut forisVisible(x.getModifiers()); boolean
Shortcut forisVisible(x.getModifiers()); boolean
Shortcut forisVisible(x.getModifiers()); <T> Constructor<T>
transform
(Constructor<T> x) Makes constructor accessible if it matches the visibility requirements, or returnsnull if it doesn't.Makes field accessible if it matches the visibility requirements, or returnsnull if it doesn't.Makes method accessible if it matches the visibility requirements, or returnsnull if it doesn't.static Visibility
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 Details
-
NONE
Ignore all -
PUBLIC
Include onlypublic classes/fields/methods. -
PROTECTED
Include onlypublic orprotected classes/fields/methods. -
DEFAULT
Include all butprivate classes/fields/methods. -
PRIVATE
Include all classes/fields/methods.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
isVisible
Identifies if the specified mod matches this visibility.Example:
PUBLIC .isVisible(MyPublicClass.class .getModifiers());//true PUBLIC .isVisible(MyPrivateClass.class .getModifiers());//false PRIVATE .isVisible(MyPrivateClass.class .getModifiers());//true NONE .isVisible(MyPublicClass.class .getModifiers());//false - Parameters:
mod
- The modifier from the object being tested (e.g. results fromClass.getModifiers()
.- Returns:
true if this visibility matches the specified modifier attribute.
-
isVisible
Shortcut forisVisible(x.getModifiers()); - Parameters:
x
- The class to check.- Returns:
true if the class is at least as visible as this object.
-
isVisible
Shortcut forisVisible(x.getModifiers()); - Parameters:
x
- The constructor to check.- Returns:
true if the constructor is at least as visible as this object.
-
isVisible
Shortcut forisVisible(x.getModifiers()); - Parameters:
x
- The field to check.- Returns:
true if the field is at least as visible as this object.
-
transform
Makes constructor accessible if it matches the visibility requirements, or returnsnull if it doesn't.Security exceptions thrown on the call to
Constructor.setAccessible(boolean)
are quietly ignored.- Type Parameters:
T
- The class type.- Parameters:
x
- The constructor.- Returns:
- The same constructor if visibility requirements met, or
null if visibility requirement not met or call toConstructor.setAccessible(boolean)
throws a security exception.
-
transform
Makes method accessible if it matches the visibility requirements, or returnsnull if it doesn't.Security exceptions thrown on the call to
Method.setAccessible(boolean)
are quietly ignored.- Parameters:
x
- The method.- Returns:
- The same method if visibility requirements met, or
null if visibility requirement not met or call toMethod.setAccessible(boolean)
throws a security exception.
-
transform
Makes field accessible if it matches the visibility requirements, or returnsnull if it doesn't.Security exceptions thrown on the call to
Field.setAccessible(boolean)
are quietly ignored.- Parameters:
x
- The field.- Returns:
- The same field if visibility requirements met, or
null if visibility requirement not met or call toField.setAccessible(boolean)
throws a security exception.
-