- java.lang.Object
- 
- java.lang.invoke.SerializedLambda
 
- 
- All Implemented Interfaces:
- Serializable
 
 public final class SerializedLambda extends Object implements Serializable Serialized form of a lambda expression. The properties of this class represent the information that is present at the lambda factory site, including static metafactory arguments such as the identity of the primary functional interface method and the identity of the implementation method, as well as dynamic metafactory arguments such as values captured from the lexical scope at the time of lambda capture.Implementors of serializable lambdas, such as compilers or language runtime libraries, are expected to ensure that instances deserialize properly. One means to do so is to ensure that the writeReplacemethod returns an instance ofSerializedLambda, rather than allowing default serialization to proceed.SerializedLambdahas areadResolvemethod that looks for a (possibly private) static method called$deserializeLambda$(SerializedLambda)in the capturing class, invokes that with itself as the first argument, and returns the result. Lambda classes implementing$deserializeLambda$are responsible for validating that the properties of theSerializedLambdaare consistent with a lambda actually captured by that class.The identity of a function object produced by deserializing the serialized form is unpredictable, and therefore identity-sensitive operations (such as reference equality, object locking, and System.identityHashCode()may produce different results in different implementations, or even upon different deserializations in the same implementation.- Since:
- 1.8
- See Also:
- LambdaMetafactory, Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description SerializedLambda(Class<?> capturingClass, String functionalInterfaceClass, String functionalInterfaceMethodName, String functionalInterfaceMethodSignature, int implMethodKind, String implClass, String implMethodName, String implMethodSignature, String instantiatedMethodType, Object[] capturedArgs)Create aSerializedLambdafrom the low-level information present at the lambda factory site.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetCapturedArg(int i)Get a dynamic argument to the lambda capture site.intgetCapturedArgCount()Get the count of dynamic arguments to the lambda capture site.StringgetCapturingClass()Get the name of the class that captured this lambda.StringgetFunctionalInterfaceClass()Get the name of the invoked type to which this lambda has been convertedStringgetFunctionalInterfaceMethodName()Get the name of the primary method for the functional interface to which this lambda has been converted.StringgetFunctionalInterfaceMethodSignature()Get the signature of the primary method for the functional interface to which this lambda has been converted.StringgetImplClass()Get the name of the class containing the implementation method.intgetImplMethodKind()Get the method handle kind (seeMethodHandleInfo) of the implementation method.StringgetImplMethodName()Get the name of the implementation method.StringgetImplMethodSignature()Get the signature of the implementation method.StringgetInstantiatedMethodType()Get the signature of the primary functional interface method after type variables are substituted with their instantiation from the capture site.
 
- 
- 
- 
Constructor Detail- 
SerializedLambdapublic SerializedLambda(Class<?> capturingClass, String functionalInterfaceClass, String functionalInterfaceMethodName, String functionalInterfaceMethodSignature, int implMethodKind, String implClass, String implMethodName, String implMethodSignature, String instantiatedMethodType, Object[] capturedArgs) Create aSerializedLambdafrom the low-level information present at the lambda factory site.- Parameters:
- capturingClass- The class in which the lambda expression appears
- functionalInterfaceClass- Name, in slash-delimited form, of static type of the returned lambda object
- functionalInterfaceMethodName- Name of the functional interface method for the present at the lambda factory site
- functionalInterfaceMethodSignature- Signature of the functional interface method present at the lambda factory site
- implMethodKind- Method handle kind for the implementation method
- implClass- Name, in slash-delimited form, for the class holding the implementation method
- implMethodName- Name of the implementation method
- implMethodSignature- Signature of the implementation method
- instantiatedMethodType- The signature of the primary functional interface method after type variables are substituted with their instantiation from the capture site
- capturedArgs- The dynamic arguments to the lambda factory site, which represent variables captured by the lambda
 
 
- 
 - 
Method Detail- 
getCapturingClasspublic String getCapturingClass() Get the name of the class that captured this lambda.- Returns:
- the name of the class that captured this lambda
 
 - 
getFunctionalInterfaceClasspublic String getFunctionalInterfaceClass() Get the name of the invoked type to which this lambda has been converted- Returns:
- the name of the functional interface class to which this lambda has been converted
 
 - 
getFunctionalInterfaceMethodNamepublic String getFunctionalInterfaceMethodName() Get the name of the primary method for the functional interface to which this lambda has been converted.- Returns:
- the name of the primary methods of the functional interface
 
 - 
getFunctionalInterfaceMethodSignaturepublic String getFunctionalInterfaceMethodSignature() Get the signature of the primary method for the functional interface to which this lambda has been converted.- Returns:
- the signature of the primary method of the functional interface
 
 - 
getImplClasspublic String getImplClass() Get the name of the class containing the implementation method.- Returns:
- the name of the class containing the implementation method
 
 - 
getImplMethodNamepublic String getImplMethodName() Get the name of the implementation method.- Returns:
- the name of the implementation method
 
 - 
getImplMethodSignaturepublic String getImplMethodSignature() Get the signature of the implementation method.- Returns:
- the signature of the implementation method
 
 - 
getImplMethodKindpublic int getImplMethodKind() Get the method handle kind (seeMethodHandleInfo) of the implementation method.- Returns:
- the method handle kind of the implementation method
 
 - 
getInstantiatedMethodTypepublic final String getInstantiatedMethodType() Get the signature of the primary functional interface method after type variables are substituted with their instantiation from the capture site.- Returns:
- the signature of the primary functional interface method after type variable processing
 
 - 
getCapturedArgCountpublic int getCapturedArgCount() Get the count of dynamic arguments to the lambda capture site.- Returns:
- the count of dynamic arguments to the lambda capture site
 
 - 
getCapturedArgpublic Object getCapturedArg(int i) Get a dynamic argument to the lambda capture site.- Parameters:
- i- the argument to capture
- Returns:
- a dynamic argument to the lambda capture site
 
 
- 
 
-