Class AddMapEntryControl

  • All Implemented Interfaces:
    Serializable

    public final class AddMapEntryControl
    extends ValueReferencingControl
    A Control for adding a new entry to a map value. Lets the user enter a key for the new entry, and provides a button to add the entry.
    Since:
    8.5.0
    See Also:
    Serialized Form
    • Constructor Detail

      • AddMapEntryControl

        public AddMapEntryControl​(IValueAccessor<?> root,
                                  String path,
                                  IValueDescriptor<?,​? extends IValueBuilder<?>> valueDescriptor)
        Creates a new add map entry control.
        Parameters:
        root - The root object against which the path is evaluated.
        path - The JSON path expression that references the map.
        valueDescriptor - The value descriptor for the map value.
    • Method Detail

      • addRow

        public void addRow()
        Adds a new map entry to the referenced map value, if possible. Creates a new default value from the provided value descriptor and adds it at the user-configured key. Does nothing if the key is empty.
      • getKey

        public String getKey()
        Gets the key for the new map entry to be added.
        Returns:
        The key for the new map entry.
      • setKey

        public void setKey​(String key)
        Sets the key for the new map entry to be added.
        Parameters:
        key - The key for the new map entry.