Interface NullValueCapable<V extends Serializable>

Type Parameters:
V - the value type of the implementing component
All Superinterfaces:
Serializable
All Known Subinterfaces:
FAbstractTextField
All Known Implementing Classes:
FPasswordField, FTextArea, FTextField

public interface NullValueCapable<V extends Serializable> extends Serializable
Interface to provide null-handling capabilities of v7/v8 legacy Vaadin components for their Vaadin Flow counterparts that do not inherently support null values.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default V
    Gets the current null representation used to display null values.
    Returns the controller that provides logic for handling null-value behavior.
    default boolean
    Whether the values matching the null representation will always be converted to null values.
    default V
    Processes the value retrieved from the underlying component before returning it to the caller.
    default V
    Processes a value before setting it into the underlying component.
    default void
    setNullRepresentation(V nullRepresentation)
    Sets the representation of a null value.
    default void
    setNullSettingAllowed(boolean nullSettingAllowed)
    Configures whether values matching the null representation should be interpreted as null values.
  • Method Details

    • getNullValueController

      NullValueController<V> getNullValueController()
      Returns the controller that provides logic for handling null-value behavior.
      Returns:
      the NullValueController instance
    • processGetValue

      default V processGetValue(V value)
      Processes the value retrieved from the underlying component before returning it to the caller. If the stored state indicates that the current value should be considered null, this method returns null instead of the null representation.
      Parameters:
      value - the value as obtained from the underlying component
      Returns:
      the processed value, potentially converted to null if conditions are met
    • processSetValue

      default V processSetValue(V value)
      Processes a value before setting it into the underlying component. If the value is null or matches the configured null representation and the appropriate null-setting conditions are met, the underlying component will store the null representation instead of null.
      Parameters:
      value - the intended value to set
      Returns:
      the processed value, the null representation if null-setting logic applies
    • isNullSettingAllowed

      default boolean isNullSettingAllowed()
      Whether the values matching the null representation will always be converted to null values.
      Returns:
      true if values matching null representation are always converted to null values, false otherwise
      See Also:
    • setNullSettingAllowed

      default void setNullSettingAllowed(boolean nullSettingAllowed)
      Configures whether values matching the null representation should be interpreted as null values. Setting this to true means that whenever the user inputs the null representation, the logical value of the component becomes null. When false, the null representation is displayed but the value is not automatically translated to null. By default, this setting is false.
      Parameters:
      nullSettingAllowed - true to always convert the null representation into a null value, false otherwise
    • getNullRepresentation

      default V getNullRepresentation()
      Gets the current null representation used to display null values. When the component cannot natively have a null value, this representation is displayed in its place. If this property is set to null, an exception will be thrown when attempting to display what should be a null value.
      Returns:
      the current representation used in place of null values
      See Also:
    • setNullRepresentation

      default void setNullRepresentation(V nullRepresentation)
      Sets the representation of a null value. If this property is set to null, attempting to display a null value will throw an exception.
      Parameters:
      nullRepresentation - the representation to use for null values