S
- type of parameter to extract from (source)T
- type of parameter that is maybe derived (target)public class ExtractDerivedParameter<S,T> extends Object
Constructor and Description |
---|
ExtractDerivedParameter(Class<?> targetClass,
java.util.function.Function<S,T> extractionFunction)
Creates with only a
targetClass . |
ExtractDerivedParameter(Class<?> targetClass,
java.util.function.Function<S,T> extractionFunction,
Class<?> sourceBaseClass)
Creates with a
classOfTarget and a baseClassOfSource . |
Modifier and Type | Method and Description |
---|---|
Optional<T> |
extractIfPossible(S parameter)
Extracts a derived parameter if possible from
parameter . |
Class<?> |
getTargetClass()
The class of the target type
T . |
public ExtractDerivedParameter(Class<?> targetClass, java.util.function.Function<S,T> extractionFunction)
targetClass
.targetClass
- the class of the target type.extractionFunction
- a function to extract the target from the source.public ExtractDerivedParameter(Class<?> targetClass, java.util.function.Function<S,T> extractionFunction, Class<?> sourceBaseClass)
classOfTarget
and a baseClassOfSource
.targetClass
- the class of the target type.extractionFunction
- a function to extract the target from the source.sourceBaseClass
- a class the source-param must be assignable to. It will be checked by
reflection.public Optional<T> extractIfPossible(S parameter)
parameter
.parameter
- the parameter to maybe derive an extracted parameter from.Optional.empty()
if it is not possible.public Class<?> getTargetClass()
T
.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.