org.elasticsearch.util.inject.internal
Enum BytecodeGen.Visibility

java.lang.Object
  extended by java.lang.Enum<BytecodeGen.Visibility>
      extended by org.elasticsearch.util.inject.internal.BytecodeGen.Visibility
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<BytecodeGen.Visibility>
Enclosing class:
BytecodeGen

public static enum BytecodeGen.Visibility
extends java.lang.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
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
abstract  BytecodeGen.Visibility and(BytecodeGen.Visibility that)
           
static BytecodeGen.Visibility forMember(java.lang.reflect.Member member)
           
static BytecodeGen.Visibility forType(java.lang.Class<?> type)
           
static BytecodeGen.Visibility valueOf(java.lang.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.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

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(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

forMember

public static BytecodeGen.Visibility forMember(java.lang.reflect.Member member)

forType

public static BytecodeGen.Visibility forType(java.lang.Class<?> type)

and

public abstract BytecodeGen.Visibility and(BytecodeGen.Visibility that)