You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we already have a eval() with a lambda to provide the default value. However, this defaultValueSupplier does NOT store it as default in the state/stateHelper.
computeIfAbsent however will store the defaultValue in the state.
See PF code:
/**
* Tries to retrieve value from stateHelper by key first. If the value is not present (or is null),
* then it is retrieved from defaultValueSupplier.
*
* Should be removed when {@link StateHelper} is extended with similar functionality.
* (see https://github.com/eclipse-ee4j/mojarra/issues/4568 for details)
* @param stateHelper The stateHelper to try to retrieve value from
* @param key The key under which value is stored in the stateHelper
* @param defaultValueSupplier The object, from which default value is retrieved
* @param <T> the expected type of returned value
* @return value from stateHelper or defaultValueSupplier
*/
public static <T> T computeIfAbsent(StateHelper stateHelper, Serializable key, Supplier<T> defaultValueSupplier) {
T value = (T) stateHelper.get(key);
if (value == null) {
value = defaultValueSupplier.get();
stateHelper.put(key, value);
}
return value;
}
The text was updated successfully, but these errors were encountered:
Similar to: eclipse-ee4j/mojarra#4568
we already have a eval() with a lambda to provide the default value. However, this defaultValueSupplier does NOT store it as default in the state/stateHelper.
computeIfAbsent however will store the defaultValue in the state.
See PF code:
The text was updated successfully, but these errors were encountered: