Package com.google.inject.internal
Enum BytecodeGen.Visibility
- java.lang.Object
-
- java.lang.Enum<BytecodeGen.Visibility>
-
- com.google.inject.internal.BytecodeGen.Visibility
-
- All Implemented Interfaces:
Serializable
,Comparable<BytecodeGen.Visibility>
- Enclosing class:
- BytecodeGen
public static enum BytecodeGen.Visibility extends Enum<BytecodeGen.Visibility>
The required visibility of a user's class from a Guice-generated class. Visibility of package-private members depends on the loading classloader: only if two classes were loaded by the same classloader can they see each other's package-private members. We need to be careful when choosing which classloader to use for generated classes. We prefer our bridge classloader, since it's OSGi-safe and doesn't leak permgen space. But often we cannot due to visibility.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description PUBLIC
Indicates that Guice-generated classes only need to call and override public members of the target class.SAME_PACKAGE
Indicates that Guice-generated classes need to call or override package-private members.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract BytecodeGen.Visibility
and(BytecodeGen.Visibility that)
static BytecodeGen.Visibility
forMember(Member member)
static BytecodeGen.Visibility
forType(Class<?> type)
static BytecodeGen.Visibility
valueOf(String name)
Returns the enum constant of this type with the specified name.static BytecodeGen.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 BytecodeGen.Visibility PUBLIC
Indicates that Guice-generated classes only need to call and override public members of the target class. These generated classes may be loaded by our bridge classloader.
-
SAME_PACKAGE
public static final BytecodeGen.Visibility SAME_PACKAGE
Indicates that Guice-generated classes need to call or override package-private members. These generated classes must be loaded in the same classloader as the target class. They won't work with OSGi, and won't get garbage collected until the target class' classloader is garbage collected.
-
-
Method Detail
-
values
public static BytecodeGen.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 (BytecodeGen.Visibility c : BytecodeGen.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 BytecodeGen.Visibility valueOf(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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
forMember
public static BytecodeGen.Visibility forMember(Member member)
-
forType
public static BytecodeGen.Visibility forType(Class<?> type)
-
and
public abstract BytecodeGen.Visibility and(BytecodeGen.Visibility that)
-
-