Enum Class BytecodeGen.Visibility

java.lang.Object
java.lang.Enum<BytecodeGen.Visibility>
com.google.inject.internal.BytecodeGen.Visibility
All Implemented Interfaces:
Serializable, Comparable<BytecodeGen.Visibility>, Constable
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 Details

    • 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.
  • Constructor Details

    • Visibility

      private Visibility()
  • Method Details

    • values

      public static BytecodeGen.Visibility[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BytecodeGen.Visibility valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - 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)