Home » openjdk-7 » java.lang.invoke » [javadoc | source]
java.lang.invoke
class: AdapterMethodHandle [javadoc | source]
java.lang.Object
   java.lang.invoke.MethodHandle
      java.lang.invoke.BoundMethodHandle
         java.lang.invoke.AdapterMethodHandle

Direct Known Subclasses:
    AsVarargsCollector

This method handle performs simple conversion or checking of a single argument.
Nested Class Summary:
static class  AdapterMethodHandle.AsVarargsCollector   
Field Summary
static final  int MAX_ARG_ROTATION     
Fields inherited from java.lang.invoke.MethodHandle:
vmtarget,  INT_FIELD,  LONG_FIELD
Method from java.lang.invoke.AdapterMethodHandle Summary:
canBoxArgument,   canBoxArgument,   canCheckCast,   canCheckCast,   canCollectArguments,   canConvertArgument,   canDropArguments,   canDupArguments,   canPairwiseConvert,   canPrimCast,   canPrimCast,   canRetype,   canRetypeOnly,   canRetypeRaw,   canRotateArguments,   canSpreadArguments,   canSwapArguments,   canUnboxArgument,   canUnboxArgument,   conversionOp,   debugString,   extractStackMove,   extractStackMove,   getConversion,   makeBoxArgument,   makeCheckCast,   makeCollectArguments,   makeDropArguments,   makeDupArguments,   makePairwiseConvert,   makePermutation,   makePrimCast,   makePrimCastOnly,   makeRetype,   makeRetypeOnly,   makeRetypeRaw,   makeRotateArguments,   makeSpreadArguments,   makeSwapArguments,   makeUnboxArgument,   makeVarargsCollector,   positiveRotation
Methods from java.lang.invoke.BoundMethodHandle:
badBoundArgumentException,   baseName,   bindPrimitiveArgument,   checkReferenceArgument,   debugString
Methods from java.lang.invoke.MethodHandle:
asCollector,   asFixedArity,   asSpreader,   asType,   asVarargsCollector,   bindTo,   debugString,   invoke,   invokeExact,   invokeWithArguments,   invokeWithArguments,   isVarargsCollector,   toString,   type
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.lang.invoke.AdapterMethodHandle Detail:
 static boolean canBoxArgument(Class<?> src,
    Class<?> dst) 
    Can an primitive boxing adapter validly convert src to dst?
 static boolean canBoxArgument(MethodType newType,
    MethodType targetType,
    int arg,
    Class<?> convType) 
    Can a boxing conversion validly convert src to dst?
 static boolean canCheckCast(Class<?> src,
    Class<?> dst) 
    Can an primitive conversion adapter validly convert src to dst?
 static boolean canCheckCast(MethodType newType,
    MethodType targetType,
    int arg,
    Class<?> castType) 
    Can a checkcast adapter validly convert the target to newType? The JVM supports all kind of reference casts, even silly ones.
 static boolean canCollectArguments(MethodType targetType,
    MethodType collectorType,
    int collectArgPos,
    boolean retainOriginalArgs) 
    Can an adapter collect a series of arguments, replacing them by zero or one results?
 static boolean canConvertArgument(Class<?> src,
    Class<?> dst,
    int level) 
    Can a JVM-level adapter directly implement the proposed argument conversion, as if by fixed-arity MethodHandle.asType?
 static boolean canDropArguments(MethodType newType,
    MethodType targetType,
    int dropArgPos,
    int dropArgCount) 
    Can an adapter simply drop arguments to convert the target to newType?
 static boolean canDupArguments(MethodType newType,
    MethodType targetType,
    int dupArgPos,
    int dupArgCount) 
    Can an adapter duplicate an argument to convert the target to newType?
 static boolean canPairwiseConvert(MethodType newType,
    MethodType oldType,
    int level) 
    Can a JVM-level adapter directly implement the proposed argument conversions, as if by fixed-arity MethodHandle.asType?
 static boolean canPrimCast(Class<?> src,
    Class<?> dst) 
    Can an primitive conversion adapter validly convert src to dst?
 static boolean canPrimCast(MethodType newType,
    MethodType targetType,
    int arg,
    Class<?> convType) 
    Can an primitive conversion adapter validly convert the target to newType? The JVM currently supports all conversions except those between floating and integral types.
 static boolean canRetype(MethodType newType,
    MethodType targetType,
    boolean raw) 
 static boolean canRetypeOnly(MethodType newType,
    MethodType targetType) 
    Can a retyping adapter (alone) validly convert the target to newType?
 static boolean canRetypeRaw(MethodType newType,
    MethodType targetType) 
    Can a retyping adapter (alone) convert the target to newType? It is allowed to widen subword types and void to int, to make bitwise conversions between float/int and double/long, and to perform unchecked reference conversions on return. This last feature requires that the caller be trusted, and perform explicit cast conversions on return values.
 static boolean canRotateArguments(MethodType newType,
    MethodType targetType,
    int firstArg,
    int argCount,
    int rotateBy) 
    Can an adapter rotate arguments to convert the target to newType?
 static boolean canSpreadArguments(MethodType newType,
    MethodType targetType,
    Class<?> spreadArgType,
    int spreadArgPos,
    int spreadArgCount) 
    Can an adapter spread an argument to convert the target to newType?
 static boolean canSwapArguments(MethodType newType,
    MethodType targetType,
    int swapArg1,
    int swapArg2) 
    Can an adapter swap two arguments to convert the target to newType?
 static boolean canUnboxArgument(Class<?> src,
    Class<?> dst,
    int level) 
    Can an primitive unboxing adapter validly convert src to dst?
 static boolean canUnboxArgument(MethodType newType,
    MethodType targetType,
    int arg,
    Class<?> convType,
    int level) 
    Can an unboxing conversion validly convert src to dst? The JVM currently supports all kinds of casting and unboxing. The convType is the unboxed type; it can be either a primitive or wrapper.
 int conversionOp() 
    One of OP_RETYPE_ONLY, etc.
 String debugString() 
 static int extractStackMove(int convOp) 
 static int extractStackMove(MethodHandle target) 
 int getConversion() 
 static MethodHandle makeBoxArgument(MethodType newType,
    MethodHandle target,
    int arg,
    Class<?> convType) 
    Factory method: Box the given argument. Return null if this cannot be done.
 static MethodHandle makeCheckCast(MethodType newType,
    MethodHandle target,
    int arg,
    Class<?> castType) 
    Factory method: Forces a cast at the given argument. The castType is the target of the cast, and can be any type with a null conversion to the corresponding target parameter. Return null if this cannot be done.
 static MethodHandle makeCollectArguments(MethodHandle target,
    MethodHandle collector,
    int collectArgPos,
    boolean retainOriginalArgs) 
    Factory method: Collect or filter selected argument(s).
 static MethodHandle makeDropArguments(MethodType newType,
    MethodHandle target,
    int dropArgPos,
    int dropArgCount) 
    Factory method: Drop selected arguments. Allow unchecked retyping of remaining arguments, pairwise. Return null if this is not possible.
 static MethodHandle makeDupArguments(MethodType newType,
    MethodHandle target,
    int dupArgPos,
    int dupArgCount) 
    Factory method: Duplicate the selected argument. Return null if this is not possible.
 static MethodHandle makePairwiseConvert(MethodType newType,
    MethodHandle target,
    int level) 
    Create a JVM-level adapter method handle to conform the given method handle to the similar newType, using only pairwise argument conversions. For each argument, convert incoming argument to the exact type needed. The argument conversions allowed are casting, boxing and unboxing, integral widening or narrowing, and floating point widening or narrowing.
 static MethodHandle makePermutation(MethodType newType,
    MethodHandle target,
    int[] argumentMap) 
    Create a JVM-level adapter method handle to permute the arguments of the given method.
 static MethodHandle makePrimCast(MethodType newType,
    MethodHandle target,
    int arg,
    Class<?> convType) 
    Factory method: Truncate the given argument with zero or sign extension, and/or convert between single and doubleword versions of integer or float. The convType is the target of the conversion, and can be any type with a null conversion to the corresponding target parameter. Return null if this cannot be done.
 static MethodHandle makePrimCastOnly(MethodType newType,
    MethodHandle target,
    int arg,
    Class<?> convType) 
 static MethodHandle makeRetype(MethodType newType,
    MethodHandle target,
    boolean raw) 
 static MethodHandle makeRetypeOnly(MethodType newType,
    MethodHandle target) 
    Factory method: Performs no conversions; simply retypes the adapter. Allows unchecked argument conversions pairwise, if they are safe. Returns null if not possible.
 static MethodHandle makeRetypeRaw(MethodType newType,
    MethodHandle target) 
 static MethodHandle makeRotateArguments(MethodType newType,
    MethodHandle target,
    int firstArg,
    int argCount,
    int rotateBy) 
    Factory method: Rotate the selected argument range. Return null if this is not possible.
 static MethodHandle makeSpreadArguments(MethodType newType,
    MethodHandle target,
    Class<?> spreadArgType,
    int spreadArgPos,
    int spreadArgCount) 
    Factory method: Spread selected argument.
 static MethodHandle makeSwapArguments(MethodType newType,
    MethodHandle target,
    int swapArg1,
    int swapArg2) 
    Factory method: Swap the selected arguments. Return null if this is not possible.
 static MethodHandle makeUnboxArgument(MethodType newType,
    MethodHandle target,
    int arg,
    Class<?> convType,
    int level) 
    Factory method: Unbox the given argument. Return null if this cannot be done.
 static MethodHandle makeVarargsCollector(MethodHandle target,
    Class<?> arrayType) 
 static int positiveRotation(int argCount,
    int rotateBy)