Home » openjdk-7 » sun.invoke.util » [javadoc | source]
sun.invoke.util
public enum class: Wrapper [javadoc | source]
java.lang.Enum
   sun.invoke.util.Wrapper
Field Summary
public  Wrapper BOOLEAN     
public  Wrapper BYTE     
public  Wrapper SHORT     
public  Wrapper CHAR     
public  Wrapper INT     
public  Wrapper LONG     
public  Wrapper FLOAT     
public  Wrapper DOUBLE     
public  Wrapper OBJECT     
public  Wrapper VOID     
Method from sun.invoke.util.Wrapper Summary:
arrayType,   asPrimitiveType,   asWrapperType,   basicTypeChar,   basicTypeChar,   bitWidth,   cast,   convert,   copyArrayBoxing,   copyArrayUnboxing,   detailString,   findPrimitiveType,   findWrapperType,   forBasicType,   forBasicType,   forPrimitiveType,   forWrapperType,   forceType,   isConvertibleFrom,   isDoubleWord,   isFloating,   isIntegral,   isNumeric,   isOther,   isPrimitiveType,   isSigned,   isSingleWord,   isSubwordOrInt,   isUnsigned,   isWrapperType,   makeArray,   primitiveType,   rawPrimitive,   rawPrimitiveType,   simpleName,   stackSlots,   unwrapRaw,   wrap,   wrap,   wrapRaw,   wrapperType,   wrapperType,   zero,   zero
Method from sun.invoke.util.Wrapper Detail:
 public Class<?> arrayType() 
 public static Class<T> asPrimitiveType(Class<T> type) 
    If {@code type} is a wrapper type, return the corresponding primitive type, else return {@code type} unchanged.
 public static Class<T> asWrapperType(Class<T> type) 
    If {@code type} is a primitive type, return the corresponding wrapper type, else return {@code type} unchanged.
 public char basicTypeChar() 
    What is the bytecode signature character for this wrapper's primitive type?
 public static char basicTypeChar(Class<?> type) 
    What is the bytecode signature character for this type? All non-primitives, including array types, report as 'L', the signature character for references.
 public int bitWidth() 
    How many bits are in the wrapped value? Returns 0 for OBJECT or VOID.
 public T cast(Object x,
    Class<T> type) 
    Cast a wrapped value to the given type, which may be either a primitive or wrapper type. The given target type must be this wrapper's primitive or wrapper type. If this wrapper is OBJECT, the target type may also be an interface, perform no runtime check. Performs standard primitive conversions, including truncation and float conversions. The given type must be compatible with this wrapper. That is, it must either be the wrapper type (or a subtype, in the case of {@code OBJECT}) or else it must be the wrapper's primitive type. Primitive conversions are only performed if the given type is itself a primitive.
 public T convert(Object x,
    Class<T> type) 
    Convert a wrapped value to the given type. The given target type must be this wrapper's primitive or wrapper type. This is equivalent to #cast , except that it refuses to perform narrowing primitive conversions.
 public  void copyArrayBoxing(Object a,
    int apos,
    Object[] values,
    int vpos,
    int length) 
 public  void copyArrayUnboxing(Object[] values,
    int vpos,
    Object a,
    int apos,
    int length) 
 public String detailString() 
    For debugging, give the details of this wrapper.
 static Wrapper findPrimitiveType(Class<?> type) 
 static Wrapper findWrapperType(Class<?> type) 
 public static Wrapper forBasicType(char type) 
    Return the wrapper that corresponds to the given bytecode signature character. Return {@code OBJECT} for the character 'L'.
 public static Wrapper forBasicType(Class<?> type) 
    Return the wrapper for the given type, if it is a primitive type, else return {@code OBJECT}.
 public static Wrapper forPrimitiveType(Class<?> type) 
    Return the wrapper that wraps values of the given type. The type may be {@code Object}, meaning the {@code OBJECT} wrapper. Otherwise, the type must be a primitive.
 public static Wrapper forWrapperType(Class<?> type) 
    Return the wrapper that wraps values into the given wrapper type. If it is {@code Object}, return {@code OBJECT}. Otherwise, it must be a wrapper type. The type must not be a primitive type.
 static Class<T> forceType(Class<?> type,
    Class<T> exampleType) 
    Cast a reference type to another reference type. If the target type is an interface, perform no runtime check. (This loophole is safe, and is allowed by the JVM verifier.) If the target type is a primitive, change it to a wrapper.
 public boolean isConvertibleFrom(Wrapper source) 
    Does the JLS 5.1.2 allow a variable of this wrapper's primitive type to be assigned from a value of the given wrapper's primitive type? Cases:
    • unboxing followed by widening primitive conversion
    • any type converted to {@code void} (i.e., dropping a method call's value)
    • boxing conversion followed by widening reference conversion to {@code Object}
    These are the cases allowed by MethodHandle.asType.
 public boolean isDoubleWord() 
    Does the wrapped value occupy two JVM stack slots?
 public boolean isFloating() 
    Is the wrapped type either float or double?
 public boolean isIntegral() 
    Is the wrapped type a primitive other than float, double, or void?
 public boolean isNumeric() 
    Is the wrapped type numeric (not void or object)?
 public boolean isOther() 
    Is the wrapped type either void or a reference?
 public static boolean isPrimitiveType(Class<?> type) 
    Query: Is the given type a primitive, such as {@code int} or {@code void}?
 public boolean isSigned() 
 public boolean isSingleWord() 
    Does the wrapped value occupy a single JVM stack slot?
 public boolean isSubwordOrInt() 
    Is the wrapped type one of int, boolean, byte, char, or short?
 public boolean isUnsigned() 
 public static boolean isWrapperType(Class<?> type) 
    Query: Is the given type a wrapper, such as {@code Integer} or {@code Void}?
 public Object makeArray(int len) 
 public Class<?> primitiveType() 
    What is the primitive type wrapped by this wrapper?
 public Wrapper rawPrimitive() 
    Report, as a wrapper, what primitive type holds this guy's raw value. Returns self for INT, LONG, OBJECT; returns LONG for DOUBLE, else returns INT.
 public Class<?> rawPrimitiveType() 
    Report what primitive type holds this guy's raw value.
 public String simpleName() 
    What is the simple name of the wrapper type?
 public int stackSlots() 
    How many JVM stack slots occupied by the wrapped value? Returns 0 for VOID.
 public long unwrapRaw(Object x) 
    Produce bitwise value which encodes the given wrapped value. Does not perform floating point conversion. Returns zero for {@code VOID}.
 public Object wrap(Object x) 
    Wrap a value in this wrapper's type. Performs standard primitive conversions, including truncation and float conversions. Performs returns the unchanged reference for {@code OBJECT}. Returns null for {@code VOID}. Returns a zero value for a null input.
 public Object wrap(int x) 
    Wrap a value (an int or smaller value) in this wrapper's type. Performs standard primitive conversions, including truncation and float conversions. Produces an {@code Integer} for {@code OBJECT}, although the exact type of the operand is not known. Returns null for {@code VOID}.
 public Object wrapRaw(long x) 
    Wrap a value (a long or smaller value) in this wrapper's type. Does not perform floating point conversion. Produces a {@code Long} for {@code OBJECT}, although the exact type of the operand is not known. Returns null for {@code VOID}.
 public Class<?> wrapperType() 
    What is the wrapper type for this wrapper?
 public Class<T> wrapperType(Class<T> exampleType) 
    What is the wrapper type for this wrapper? Otherwise, the example type must be the wrapper type, or the corresponding primitive type. (For {@code OBJECT}, the example type can be any non-primitive, and is normalized to {@code Object.class}.) The resulting class type has the same type parameter.
 public Object zero() 
    Produce a zero value for the given wrapper type. This will be a numeric zero for a number or character, false for a boolean, and null for a reference or void. The common thread is that this is what is contained in a default-initialized variable of the given primitive type. (For void, it is what a reflective method returns instead of no value at all.)
 public T zero(Class<T> type) 
    Produce a zero value for the given wrapper type T. The optional argument must a type compatible with this wrapper. Equivalent to {@code this.cast(this.zero(), type)}.