Class ValueFilterValues<T,S>
- java.lang.Object
-
- com.evolveum.midpoint.repo.sqlbase.filtering.ValueFilterValues<T,S>
-
- Type Parameters:
T
- type of filter valueS
- type of value after conversion (can by the same like T)
public class ValueFilterValues<T,S> extends Object
Object wraps zero, one or multiple values and makes their processing easier. Instead of just wrapping the values it uses the whole filter object to utilize its convenience methods. Returned values are typed to Object, because they can be converted from original type. Conversion is moved into this class, so the client code doesn't have to handle translation fromPrismPropertyValue
to "real value" and then to convert it. BothsingleValue()
andallValues()
are handled the same way. IfconversionFunction
is used anyIllegalArgumentException
will be rewrapped asQueryException
, other runtime exceptions are not intercepted.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull List<?>
allValues()
Returns multiple values, all converted, or empty list - never null.@NotNull List<T>
allValuesRaw()
Returns multiple real values without conversion or empty list - never null.static <T> ValueFilterValues<T,T>
from(@NotNull PropertyValueFilter<T> filter)
static <T,S>
ValueFilterValues<T,S>from(@NotNull PropertyValueFilter<T> filter, @Nullable Function<T,S> conversionFunction)
boolean
isEmpty()
boolean
isMultiValue()
@Nullable Object
singleValue()
Returns single value or null or fails if there are multiple values, all converted.T
singleValueRaw()
Returns single value or null or fails if there are multiple values without conversion.
-
-
-
Method Detail
-
from
public static <T> ValueFilterValues<T,T> from(@NotNull @NotNull PropertyValueFilter<T> filter)
-
from
public static <T,S> ValueFilterValues<T,S> from(@NotNull @NotNull PropertyValueFilter<T> filter, @Nullable @Nullable Function<T,S> conversionFunction)
-
singleValue
@Nullable public @Nullable Object singleValue() throws QueryException
Returns single value or null or fails if there are multiple values, all converted.- Throws:
QueryException
-
singleValueRaw
@Nullable public T singleValueRaw()
Returns single value or null or fails if there are multiple values without conversion. Null-safe version ofValueFilter.getSingleValue()
followed byPrismPropertyValue.getRealValue()
.
-
allValues
@NotNull public @NotNull List<?> allValues()
Returns multiple values, all converted, or empty list - never null.
-
allValuesRaw
@NotNull public @NotNull List<T> allValuesRaw()
Returns multiple real values without conversion or empty list - never null.
-
isEmpty
public boolean isEmpty()
-
isMultiValue
public boolean isMultiValue()
-
-