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 writeReplace method returns
an instance of SerializedLambda, rather than allowing default
serialization to proceed.
SerializedLambda has a readResolve method 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 the SerializedLambda are 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.
LambdaMetafactory
| Modifier and Type | Field and Description |
|---|---|
| private final Object[] | |
| private final Class | |
| private final String | |
| private final String | |
| private final String | |
| private final String | |
| private final int | |
| private final String | |
| private final String | |
| private final String | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | SerializedLambda(Class<?>
The class in which the lambda expression appears capturingClass, String Name, in slash-delimited form, of static
type of the returned lambda object functionalInterfaceClass, String Name of the functional interface
method for the present at the
lambda factory site functionalInterfaceMethodName, String Signature of the functional
interface method present at
the lambda factory site functionalInterfaceMethodSignature, int Method handle kind for the implementation method implMethodKind, String Name, in slash-delimited form, for the class holding
the implementation method implClass, String Name of the implementation method implMethodName, String Signature of the implementation method implMethodSignature, String The signature of the primary functional
interface method after type variables
are substituted with their instantiation
from the capture site instantiatedMethodType, Object[] The dynamic arguments to the lambda factory site,
which represent variables captured by
the lambda capturedArgs)Create a |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: a dynamic argument to the lambda capture sitethe argument to capture i)Get a dynamic argument to the lambda capture site. |
| public int | Returns: the count of dynamic arguments to the lambda capture siteGet the count of dynamic arguments to the lambda capture site. |
| public String | Returns: the name of the class that captured this lambdaGet the name of the class that captured this lambda. |
| public String | Returns: the name of the functional interface class to which this lambda has been convertedGet the name of the invoked type to which this lambda has been converted |
| public String | Returns: the name of the primary methods of the functional interfaceGet the name of the primary method for the functional interface to which this lambda has been converted. |
| public String | Returns: the signature of the primary method of the functional interfaceGet the signature of the primary method for the functional interface to which this lambda has been converted. |
| public String | Returns: the name of the class containing the implementation methodGet the name of the class containing the implementation method. |
| public int | Returns: the method handle kind of the implementation methodGet the method handle kind (see |
| public String | Returns: the name of the implementation methodGet the name of the implementation method. |
| public String | Returns: the signature of the implementation methodGet the signature of the implementation method. |
| public final String | Returns: the signature of the primary functional interface method after type variable processingGet the signature of the primary functional interface method after type variables are substituted with their instantiation from the capture site. |
| private Object | |
| public String |
| capturedArgs | back to summary |
|---|---|
private final Object[] capturedArgs
| |
| capturingClass | back to summary |
|---|---|
| private final Class<?> capturingClass | |
| functionalInterfaceClass | back to summary |
|---|---|
| private final String functionalInterfaceClass | |
| functionalInterfaceMethodName | back to summary |
|---|---|
| private final String functionalInterfaceMethodName | |
| functionalInterfaceMethodSignature | back to summary |
|---|---|
| private final String functionalInterfaceMethodSignature | |
| implClass | back to summary |
|---|---|
| private final String implClass | |
| implMethodKind | back to summary |
|---|---|
| private final int implMethodKind | |
| implMethodName | back to summary |
|---|---|
| private final String implMethodName | |
| implMethodSignature | back to summary |
|---|---|
| private final String implMethodSignature | |
| instantiatedMethodType | back to summary |
|---|---|
| private final String instantiatedMethodType | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID
| |
| SerializedLambda | back to summary |
|---|---|
| public SerializedLambda(Class<?> capturingClass, String functionalInterfaceClass, String functionalInterfaceMethodName, String functionalInterfaceMethodSignature, int implMethodKind, String implClass, String implMethodName, String implMethodSignature, String instantiatedMethodType, Object[] capturedArgs) Create a
| |
| getCapturedArg | back to summary |
|---|---|
| public Object getCapturedArg(int i) Get a dynamic argument to the lambda capture site.
| |
| getCapturedArgCount | back to summary |
|---|---|
| public int getCapturedArgCount() Get the count of dynamic arguments to the lambda capture site.
| |
| getCapturingClass | back to summary |
|---|---|
| public String getCapturingClass() Get the name of the class that captured this lambda.
| |
| getFunctionalInterfaceClass | back to summary |
|---|---|
| public String getFunctionalInterfaceClass() Get the name of the invoked type to which this lambda has been converted
| |
| getFunctionalInterfaceMethodName | back to summary |
|---|---|
| public String getFunctionalInterfaceMethodName() Get the name of the primary method for the functional interface to which this lambda has been converted.
| |
| getFunctionalInterfaceMethodSignature | back to summary |
|---|---|
| public String getFunctionalInterfaceMethodSignature() Get the signature of the primary method for the functional interface to which this lambda has been converted.
| |
| getImplClass | back to summary |
|---|---|
| public String getImplClass() Get the name of the class containing the implementation method.
| |
| getImplMethodKind | back to summary |
|---|---|
| public int getImplMethodKind() Get the method handle kind (see
| |
| getImplMethodName | back to summary |
|---|---|
| public String getImplMethodName() Get the name of the implementation method.
| |
| getImplMethodSignature | back to summary |
|---|---|
| public String getImplMethodSignature() Get the signature of the implementation method.
| |
| getInstantiatedMethodType | back to summary |
|---|---|
| public final String getInstantiatedMethodType() Get the signature of the primary functional interface method after type variables are substituted with their instantiation from the capture site.
| |
| readResolve | back to summary |
|---|---|
| private Object readResolve() throws ObjectStreamException Resolve a
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |