Class FieldDescriptor

    • Method Detail

      • getName

        public String getName()
        Gets the name of this field. The name of the field must be unique per Table or AdapterConfigurationGuiDescriptor. The field is used to identify the field during various processing steps.
        Returns:
        the name of the field.
      • setLabel

        public void setLabel​(String label)
        Sets the label of this field that will be rendered in the administrative console configuration pages. If set, the label will take precedence over the name for how the field is rendered in the administrative console. This is intended to be used as a strategy for renaming fields in future releases of a plugin, while preserving the handling of existing configuration.
        Parameters:
        label - The desired field label value.
        Since:
        9.0
      • getLabel

        public String getLabel()
        Gets the label of this field that will be rendered in the administrative console configuration pages. If it is not explicitly set, the name of the field will be returned as the label.
        Returns:
        the label of the field.
        Since:
        9.0
      • getDescription

        public String getDescription()
        Gets a description of this field.
        Returns:
        a description
      • getDefaultValue

        public String getDefaultValue()
        Gets the default value for this field.
        Returns:
        the default value.
      • getFormattedValue

        public String getFormattedValue​(String value)
        Gets a value that is formatted according to this FieldDescriptor. It is meant to be overridden by subclasses. By default the specified value is simply returned.
        Parameters:
        value - The value to be formatted.
        Returns:
        The formatted value that is understandable to this FieldDescriptor.
      • setDefaultValue

        public void setDefaultValue​(String defaultValue)
        Sets the default value for this individual field.
        Parameters:
        defaultValue - for this field.
      • setDefaultForLegacyConfig

        public void setDefaultForLegacyConfig​(String defaultValue)
        This method allows a newly added field to have a default value specifically for instances of a plugin that were created before adding this field.
        Parameters:
        defaultValue - The default value that should be used for legacy configurations.
      • getDefaultForLegacyConfig

        public String getDefaultForLegacyConfig()
        This method returns a default value for the field of a plugin instance created before adding the current field.
        Returns:
        The default value that should be used for legacy configurations.
      • isHidden

        public boolean isHidden()
        This method returns a boolean indicating if the current field is hidden on the user interface.
        Returns:
        True if this field is not shown in the user interface. False otherwise.
      • setHidden

        public void setHidden​(boolean hidden)
        This method sets whether this field is hidden in the user interface.
        Parameters:
        hidden - True if this field is hidden from the user interface. False otherwise.
      • addValidator

        public void addValidator​(FieldValidator validator,
                                 boolean skipIfEmptyValue)
        Adds a FieldValidator to the back of the ordered list of validators for this field.
        Parameters:
        validator - validator the FieldValidator
        skipIfEmptyValue - a boolean indicating if validator should be skipped when the field value is null or empty. This is useful for situations where you want to perform some validation on a field only if the user entered a value for the field. For example, you might want a field that is not required but must be an integer if used.