Class StringControl

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MultiLineStringControl, SingleLineStringControl

public abstract class StringControl extends EditableControl<String>
A base class for Controls used to edit string values that must conform to a IValueDescriptor.
Since:
8.5.0
See Also:
  • Constructor Details

    • StringControl

      protected StringControl(String type, IValueAccessor<?> root, String path, IStringValueDescriptor descriptor, boolean allowNull)
      Creates a new string control.
      Parameters:
      type - The type of the control that determines how it is rendered.
      root - The root object against which the path is evaluated.
      path - The JSON path expression that references the value.
      descriptor - The descriptor that describes the string value being edited.
      allowNull - Whether null values are allowed.
  • Method Details

    • getMaxLength

      public int getMaxLength()
      Gets the maximum allowed length of the string. This value is read from the given value descriptor.
      Returns:
      The maximum allowed length of the string, or Integer.MAX_VALUE if no maximum is specified.
    • getMinLength

      public int getMinLength()
      Gets the minimum required length of the string. This value is read from the given value descriptor.
      Returns:
      The minimum required length of the string, or 0 if no minimum is specified.
    • coerceValue

      protected String coerceValue(Object value)
      Description copied from class: EditableControl
      Coerces the given value to conform to the restrictions imposed by the value descriptor. This method is called by EditableControl.getValue() and EditableControl.setValue(Object) to ensure that the value is always valid.
      Specified by:
      coerceValue in class EditableControl<String>
      Parameters:
      value - The value to coerce.
      Returns:
      The coerced value.