T
- The type of the input to the function.R
- The type of the returned result of the function.public interface SerializableFunction<T,R>
extends java.io.Serializable
This generic utility interface has been added to the AMPS client to better support interoperability with other AMPS components and third-party software. Implementations of this interface can represent any function that takes a single argument and returns a result. This function is tagged to be serializable.
Example usages of this interface include the following:
Within the AMPS/Apache Spark integration component, there is a need for a
serializable function that returns an AMPS Client
, given a Java
Properties
object. Such implementations would have this signature:
SerializableFunction<Properties, Client>
Within the 60East Spark utility client, there is an interface called AuthenticatorFactory, whose single method has the following signature:
Authenticator createAuthenticator(String connectionURI)
End-users can instead provide an implementation of this interface using the following signature: SerializableFunction<String, Authenticator>
NOTE: In a future release, once support for Java 7 is dropped, this interface will be modified to also extend java.util.function.Function
Modifier and Type | Method and Description |
---|---|
R |
apply(T t)
Invokes the function with the specified argument of type T and returns
a result of type R.
|