Package org.forgerock.util
Class CloseSilentlyFunction<VIN extends Closeable,VOUT,E extends Exception>
- java.lang.Object
 - 
- org.forgerock.util.CloseSilentlyFunction<VIN,VOUT,E>
 
 
- 
- Type Parameters:
 VIN- The type of the function input-parameter, which implementsCloseable.VOUT- The type of the function result, orVoidif the function does not return anything (i.e. it only has side-effects).E- The type of the exception thrown by the function, orNeverThrowsExceptionif no exception is thrown by the function.
- All Implemented Interfaces:
 Function<VIN,VOUT,E>
public class CloseSilentlyFunction<VIN extends Closeable,VOUT,E extends Exception> extends Object implements Function<VIN,VOUT,E>
Functionthat silently closes an input-parameter after a delegate-function'sFunction.apply(Object)is invoked. The staticcloseSilently(Function)method is provided for convenience. 
- 
- 
Constructor Summary
Constructors Constructor Description CloseSilentlyFunction(Function<VIN,VOUT,E> delegate)Creates a newCloseSilentlyFunctioninstance. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VOUTapply(VIN value)Invokes the delegate function'sFunction.apply(Object)with the input parametervalue, closes it, and returns the result.static <IN extends Closeable,OUT,EX extends Exception>
Function<IN,OUT,EX>closeSilently(Function<IN,OUT,EX> delegate)Wraps a delegate function in aCloseSilentlyFunction. 
 - 
 
- 
- 
Method Detail
- 
apply
public VOUT apply(VIN value) throws E extends Exception
Invokes the delegate function'sFunction.apply(Object)with the input parametervalue, closes it, and returns the result. 
- 
closeSilently
public static <IN extends Closeable,OUT,EX extends Exception> Function<IN,OUT,EX> closeSilently(Function<IN,OUT,EX> delegate)
Wraps a delegate function in aCloseSilentlyFunction.- Type Parameters:
 IN- The type of the function input-parameter, which implementsCloseable.OUT- The type of the function result, orVoidif the function does not return anything (i.e. it only has side-effects).EX- The type of the exception thrown by the function, orNeverThrowsExceptionif no exception is thrown by the function.- Parameters:
 delegate- Delegate function.- Returns:
 - New 
CloseSilentlyFunctioninstance. 
 
 - 
 
 -