Package com.cloudforge.core.config
Class CapacityValidator
java.lang.Object
com.cloudforge.core.config.CapacityValidator
- All Implemented Interfaces:
FieldValidator
Validates that maxCapacity >= minCapacity for scaling configurations.
This validator ensures consistent capacity settings for auto-scaling groups, ECS services, and other scalable resources.
Usage:
@ConfigField(
displayName = "Maximum Capacity",
validators = {"CapacityValidator"}
)
public int maxCapacity = 10;
Validation Logic:
- Looks for fields named "minCapacity" and "maxCapacity"
- If both exist, validates maxCapacity >= minCapacity
- Skips validation if either field is missing or null
- Since:
- 3.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvalidate(ConfigFieldInfo field, Object value, Object config) Validates a field value in the context of the complete configuration.
-
Constructor Details
-
CapacityValidator
public CapacityValidator()
-
-
Method Details
-
validate
Description copied from interface:FieldValidatorValidates a field value in the context of the complete configuration.- Specified by:
validatein interfaceFieldValidator- Parameters:
field- metadata about the field being validatedvalue- the value to validateconfig- the complete configuration object (allows accessing other fields)- Returns:
- validation result (ok or error with message)
-