Record Class ConfigFieldInfo

java.lang.Object
java.lang.Record
com.cloudforge.core.config.ConfigFieldInfo
Record Components:
fieldName - the Java field name
displayName - the user-friendly display name
description - the field description for user help
category - the configuration category for grouping
visibleWhen - the visibility condition expression
dependsOn - the field this depends on
required - whether the field is required
example - an example value for user guidance
allowedValues - array of allowed values (for constrained choices)
min - the minimum value for numeric fields
max - the maximum value for numeric fields
pattern - the regex pattern for string validation
defaultFrom - the ApplicationSpec method to get default value from
sensitive - whether this field contains sensitive data
sourceConfig - the field containing the source location for sensitive data
tags - the field tags for categorization and filtering
validators - the custom validator class names
order - the display order for sorting fields
type - the Java type of the field
field - the reflected Field object

public record ConfigFieldInfo(String fieldName, String displayName, String description, String category, String visibleWhen, String dependsOn, boolean required, String example, String[] allowedValues, double min, double max, String pattern, String defaultFrom, boolean sensitive, String sourceConfig, FieldTag[] tags, String[] validators, int order, Class<?> type, Field field) extends Record
Runtime metadata for a configuration field discovered via introspection.

Encapsulates all information from ConfigField annotation plus reflection metadata needed for prompting, validation, and value assignment.

Since:
3.0.0
  • Constructor Details

    • ConfigFieldInfo

      public ConfigFieldInfo(String fieldName, String displayName, String description, String category, String visibleWhen, String dependsOn, boolean required, String example, String[] allowedValues, double min, double max, String pattern, String defaultFrom, boolean sensitive, String sourceConfig, FieldTag[] tags, String[] validators, int order, Class<?> type, Field field)
      Creates an instance of a ConfigFieldInfo record class.
      Parameters:
      fieldName - the value for the fieldName record component
      displayName - the value for the displayName record component
      description - the value for the description record component
      category - the value for the category record component
      visibleWhen - the value for the visibleWhen record component
      dependsOn - the value for the dependsOn record component
      required - the value for the required record component
      example - the value for the example record component
      allowedValues - the value for the allowedValues record component
      min - the value for the min record component
      max - the value for the max record component
      pattern - the value for the pattern record component
      defaultFrom - the value for the defaultFrom record component
      sensitive - the value for the sensitive record component
      sourceConfig - the value for the sourceConfig record component
      tags - the value for the tags record component
      validators - the value for the validators record component
      order - the value for the order record component
      type - the value for the type record component
      field - the value for the field record component
  • Method Details

    • from

      public static ConfigFieldInfo from(Field field)
      Creates ConfigFieldInfo from a field with @ConfigField annotation.
    • getValue

      public Object getValue(Object config)
      Gets the current value of this field from the config object.
    • setValue

      public void setValue(Object config, Object value)
      Sets the value of this field in the config object.
    • hasTag

      public boolean hasTag(FieldTag tag)
      Checks if this field has a specific tag.
    • tagList

      public List<FieldTag> tagList()
      Gets all tags as a list.
    • isVisible

      public boolean isVisible(Object appSpec, Object config)
      Checks if this field is visible based on the current configuration.
      Parameters:
      appSpec - the application spec (may be null)
      config - the deployment config object
      Returns:
      true if the field should be visible, false otherwise
    • validate

      public ValidationResult validate(Object value, Object config)
      Validates the value according to field constraints and custom validators.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • fieldName

      public String fieldName()
      Returns the value of the fieldName record component.
      Returns:
      the value of the fieldName record component
    • displayName

      public String displayName()
      Returns the value of the displayName record component.
      Returns:
      the value of the displayName record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • category

      public String category()
      Returns the value of the category record component.
      Returns:
      the value of the category record component
    • visibleWhen

      public String visibleWhen()
      Returns the value of the visibleWhen record component.
      Returns:
      the value of the visibleWhen record component
    • dependsOn

      public String dependsOn()
      Returns the value of the dependsOn record component.
      Returns:
      the value of the dependsOn record component
    • required

      public boolean required()
      Returns the value of the required record component.
      Returns:
      the value of the required record component
    • example

      public String example()
      Returns the value of the example record component.
      Returns:
      the value of the example record component
    • allowedValues

      public String[] allowedValues()
      Returns the value of the allowedValues record component.
      Returns:
      the value of the allowedValues record component
    • min

      public double min()
      Returns the value of the min record component.
      Returns:
      the value of the min record component
    • max

      public double max()
      Returns the value of the max record component.
      Returns:
      the value of the max record component
    • pattern

      public String pattern()
      Returns the value of the pattern record component.
      Returns:
      the value of the pattern record component
    • defaultFrom

      public String defaultFrom()
      Returns the value of the defaultFrom record component.
      Returns:
      the value of the defaultFrom record component
    • sensitive

      public boolean sensitive()
      Returns the value of the sensitive record component.
      Returns:
      the value of the sensitive record component
    • sourceConfig

      public String sourceConfig()
      Returns the value of the sourceConfig record component.
      Returns:
      the value of the sourceConfig record component
    • tags

      public FieldTag[] tags()
      Returns the value of the tags record component.
      Returns:
      the value of the tags record component
    • validators

      public String[] validators()
      Returns the value of the validators record component.
      Returns:
      the value of the validators record component
    • order

      public int order()
      Returns the value of the order record component.
      Returns:
      the value of the order record component
    • type

      public Class<?> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • field

      public Field field()
      Returns the value of the field record component.
      Returns:
      the value of the field record component