Interface ObjectInputFilterWithException<E extends Exception>
-
- Type Parameters:
E- the type of the potential exception of the function
- All Superinterfaces:
ExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,ObjectInputFilterWithException<E>>,ObjectReturnExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>>,ObjectInputFilter.Status,ObjectInputFilterWithException<E>>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ObjectInputFilterWithException<E extends Exception> extends ObjectReturnExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>>,ObjectInputFilter.Status,ObjectInputFilterWithException<E>>
Filter classes, array lengths, and graph metrics during deserialization that may throw exception. If set on anObjectInputStream, thecheckInput(FilterInfo)method is called to validate classes, the length of each array, the number of objects being read from the stream, the depth of the graph, and the total number of bytes read from the stream.General contract
Status checkInput(FilterInfo filterInfo) throws E- The functional method.- uncheck - Return a
ObjectInputFilter - lift - Return a
Function<FilterInfo, Optional<Status>> - ignore - Return a
ObjectInputFilter
- Since:
- 2.0.0
- See Also:
ObjectInputFilter
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ObjectInputFilter.StatuscheckInput(ObjectInputFilter.FilterInfo filterInfo)Check the class, array length, number of object references, depth, stream size, and other available filtering information.default ObjectInputFilter.StatusdefaultValue()Defines the default value (by defaultnull) returned by the ignore and ignored method.static <E extends Exception>
ObjectInputFilterWithException<E>failing(Supplier<E> exceptionBuilder)Returns a ObjectInputFilter that always throw exception.default ObjectInputFilterignore()Converts thisObjectInputFilterWithExceptionto a liftedObjectInputFilterreturningStatus.UNDECIDED(or the value redefined by the methoddefaultValue()) in case of exception.static <E extends Exception>
ObjectInputFilterignored(ObjectInputFilterWithException<E> function)Converts aObjectInputFilterWithExceptionto a liftedObjectInputFilterreturningStatus.UNDECIDEDin case of exception.static <E extends Exception>
ObjectInputFilterignored(ObjectInputFilterWithException<E> function, ObjectInputFilter.Status defaultValue)Converts aObjectInputFilterWithExceptionto a liftedObjectInputFilterreturning a default value in case of exception.default Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>lift()Converts thisObjectInputFilterWithExceptionto a liftedFunctionusingOptionalas return value.static <E extends Exception>
Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>lifted(ObjectInputFilterWithException<E> function)Converts aObjectInputFilterWithExceptionto a liftedObjectInputFilterusingOptionalas return value.default Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>>stage()Convert thisObjectInputFilterWithExceptionto a liftedObjectInputFilterreturnCompletionStageas return value.static <E extends Exception>
Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>>staged(ObjectInputFilterWithException<E> function)Convert thisObjectInputFilterWithExceptionto a liftedFunctionreturnCompletionStageas return value.default ObjectInputFilteruncheck()Converts thisObjectInputFilterWithExceptionto aObjectInputFilterthat convert exception toRuntimeException.static <E extends Exception>
ObjectInputFilterunchecked(ObjectInputFilterWithException<E> function)Converts aObjectInputFilterWithExceptionto aObjectInputFilterthat convert exception toRuntimeException.static <E extends Exception>
ObjectInputFilterunchecked(ObjectInputFilterWithException<E> function, Function<Exception,RuntimeException> exceptionMapper)Converts aObjectInputFilterWithExceptionto aObjectInputFilterthat wraps exception toRuntimeExceptionby using the provided mapping function.-
Methods inherited from interface ch.powerunit.extensions.exceptions.ExceptionHandlerSupport
documented, exceptionMapper
-
Methods inherited from interface ch.powerunit.extensions.exceptions.ObjectReturnExceptionHandlerSupport
notThrowingHandler, throwingHandler
-
-
-
-
Method Detail
-
checkInput
ObjectInputFilter.Status checkInput(ObjectInputFilter.FilterInfo filterInfo) throws E extends Exception
Check the class, array length, number of object references, depth, stream size, and other available filtering information. Implementations of this method check the contents of the object graph being created during deserialization. The filter returnsStatus.ALLOWED,Status.REJECTED, orStatus.UNDECIDED.- Parameters:
filterInfo- provides information about the current object being deserialized, if any, and the status of theObjectInputStream- Returns:
Status.ALLOWEDif accepted,Status.REJECTEDif rejected,Status.UNDECIDEDif undecided.- Throws:
E- any exceptionE extends Exception- See Also:
ObjectInputFilter.checkInput(java.io.ObjectInputFilter.FilterInfo)
-
uncheck
default ObjectInputFilter uncheck()
Converts thisObjectInputFilterWithExceptionto aObjectInputFilterthat convert exception toRuntimeException.- Specified by:
uncheckin interfaceExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,ObjectInputFilterWithException<E extends Exception>>- Specified by:
uncheckin interfaceObjectReturnExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>>,ObjectInputFilter.Status,ObjectInputFilterWithException<E extends Exception>>- Returns:
- the unchecked ObjectInputFilter
- See Also:
unchecked(ObjectInputFilterWithException),unchecked(ObjectInputFilterWithException, Function),ObjectInputFilter
-
lift
default Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>> lift()
Converts thisObjectInputFilterWithExceptionto a liftedFunctionusingOptionalas return value.- Specified by:
liftin interfaceExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,ObjectInputFilterWithException<E extends Exception>>- Specified by:
liftin interfaceObjectReturnExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>>,ObjectInputFilter.Status,ObjectInputFilterWithException<E extends Exception>>- Returns:
- the lifted function
- See Also:
lifted(ObjectInputFilterWithException),Function
-
defaultValue
default ObjectInputFilter.Status defaultValue()
Description copied from interface:ObjectReturnExceptionHandlerSupportDefines the default value (by defaultnull) returned by the ignore and ignored method.- Specified by:
defaultValuein interfaceObjectReturnExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>>,ObjectInputFilter.Status,ObjectInputFilterWithException<E extends Exception>>- Returns:
- the default value for the ignore/ignored method.
-
ignore
default ObjectInputFilter ignore()
Converts thisObjectInputFilterWithExceptionto a liftedObjectInputFilterreturningStatus.UNDECIDED(or the value redefined by the methoddefaultValue()) in case of exception.- Specified by:
ignorein interfaceExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,ObjectInputFilterWithException<E extends Exception>>- Specified by:
ignorein interfaceObjectReturnExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>>,ObjectInputFilter.Status,ObjectInputFilterWithException<E extends Exception>>- Returns:
- the function that ignore error
- See Also:
ignored(ObjectInputFilterWithException),Function
-
stage
default Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>> stage()
Convert thisObjectInputFilterWithExceptionto a liftedObjectInputFilterreturnCompletionStageas return value.- Specified by:
stagein interfaceObjectReturnExceptionHandlerSupport<ObjectInputFilter,Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>>,Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>>,ObjectInputFilter.Status,ObjectInputFilterWithException<E extends Exception>>- Returns:
- the lifted function
- See Also:
staged(ObjectInputFilterWithException),CompletionStage
-
failing
static <E extends Exception> ObjectInputFilterWithException<E> failing(Supplier<E> exceptionBuilder)
Returns a ObjectInputFilter that always throw exception.- Type Parameters:
E- the type of the exception- Parameters:
exceptionBuilder- the supplier to create the ObjectInputFilter the type of the result of the function- Returns:
- a ObjectInputFilter that always throw exception
-
unchecked
static <E extends Exception> ObjectInputFilter unchecked(ObjectInputFilterWithException<E> function)
Converts aObjectInputFilterWithExceptionto aObjectInputFilterthat convert exception toRuntimeException.- Type Parameters:
E- the type of the potential exception- Parameters:
function- to be unchecked- Returns:
- the unchecked exception
- Throws:
NullPointerException- if function is null- See Also:
uncheck(),unchecked(ObjectInputFilterWithException, Function)
-
unchecked
static <E extends Exception> ObjectInputFilter unchecked(ObjectInputFilterWithException<E> function, Function<Exception,RuntimeException> exceptionMapper)
Converts aObjectInputFilterWithExceptionto aObjectInputFilterthat wraps exception toRuntimeExceptionby using the provided mapping function.- Type Parameters:
E- the type of the potential exception- Parameters:
function- the be uncheckedexceptionMapper- a function to convert the exception to the runtime exception.- Returns:
- the unchecked exception
- Throws:
NullPointerException- if function or exceptionMapper is null- See Also:
uncheck(),unchecked(ObjectInputFilterWithException)
-
lifted
static <E extends Exception> Function<ObjectInputFilter.FilterInfo,Optional<ObjectInputFilter.Status>> lifted(ObjectInputFilterWithException<E> function)
Converts aObjectInputFilterWithExceptionto a liftedObjectInputFilterusingOptionalas return value.- Type Parameters:
E- the type of the potential exception- Parameters:
function- to be lifted- Returns:
- the lifted function
- Throws:
NullPointerException- if function is null- See Also:
lift()
-
ignored
static <E extends Exception> ObjectInputFilter ignored(ObjectInputFilterWithException<E> function)
Converts aObjectInputFilterWithExceptionto a liftedObjectInputFilterreturningStatus.UNDECIDEDin case of exception.- Type Parameters:
E- the type of the potential exception- Parameters:
function- to be lifted- Returns:
- the lifted function
- Throws:
NullPointerException- if function is null- See Also:
ignore()
-
ignored
static <E extends Exception> ObjectInputFilter ignored(ObjectInputFilterWithException<E> function, ObjectInputFilter.Status defaultValue)
Converts aObjectInputFilterWithExceptionto a liftedObjectInputFilterreturning a default value in case of exception.- Type Parameters:
E- the type of the potential exception- Parameters:
function- to be lifteddefaultValue- the default value in case of exception. Can't be null.- Returns:
- the lifted function
- Throws:
NullPointerException- if function or defaultValue is null- Since:
- 3.0.0
- See Also:
ignore(),ignored(ObjectInputFilterWithException)
-
staged
static <E extends Exception> Function<ObjectInputFilter.FilterInfo,CompletionStage<ObjectInputFilter.Status>> staged(ObjectInputFilterWithException<E> function)
Convert thisObjectInputFilterWithExceptionto a liftedFunctionreturnCompletionStageas return value.- Type Parameters:
E- the type of the potential exception- Parameters:
function- to be lifted- Returns:
- the lifted function
- Throws:
NullPointerException- if function is null- See Also:
stage()
-
-