Package react4j.internal
Class IntrospectUtil
java.lang.Object
react4j.internal.IntrospectUtil
@OmitType(unless="react4j.store_debug_data_as_state")
public final class IntrospectUtil
extends Object
Utilities for introspecting the React4j views and runtime.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
collectDependencyDebugData
(Observer observer, jsinterop.base.JsPropertyMap<Object> data) For the specified observer, collect all dependencies and record them in data to be emitted as debug data.static Object
getValue
(ObservableValueInfo observableInfo) Return the value for specified observable.static boolean
prepareStateUpdate
(jsinterop.base.JsPropertyMap<Object> newState, jsinterop.base.JsPropertyMap<Object> currentState) Prepare the newState value to be updated given specified current state.
-
Method Details
-
getValue
Return the value for specified observable. Exceptions are caught and types are converted to strings usingObject.toString()
- Parameters:
observableInfo
- the observable.- Returns:
- the value as a string.
-
collectDependencyDebugData
public static void collectDependencyDebugData(@Nonnull Observer observer, @Nonnull jsinterop.base.JsPropertyMap<Object> data) For the specified observer, collect all dependencies and record them in data to be emitted as debug data.- Parameters:
observer
- the observer.data
- the target in which to place debug data.
-
prepareStateUpdate
public static boolean prepareStateUpdate(@Nonnull jsinterop.base.JsPropertyMap<Object> newState, @Nullable jsinterop.base.JsPropertyMap<Object> currentState) Prepare the newState value to be updated given specified current state. If no changes are required then return false.- Parameters:
newState
- the new "state" of the view.currentState
- the current "state" of the view.- Returns:
- true if newState needs to be saved to native view, false otherwise.
-