Search in sources :

Example 1 with Validator

use of com.thinkbiganalytics.policy.validation.Validator in project kylo by Teradata.

the class AvailablePolicies method discoverValidationRules.

public static List<FieldValidationRule> discoverValidationRules() {
    List<FieldValidationRule> rules = new ArrayList<>();
    Set<Class<?>> validators = ReflectionPolicyAnnotationDiscoverer.getTypesAnnotatedWith(Validator.class);
    for (Class c : validators) {
        Validator validator = (Validator) c.getAnnotation(Validator.class);
        List<FieldRuleProperty> properties = ValidatorAnnotationTransformer.instance().getUiProperties(c);
        rules.add(new FieldValidationRuleBuilder(validator.name()).description(validator.description()).addProperties(properties).objectClassType(c).build());
    }
    return rules;
}
Also used : FieldValidationRule(com.thinkbiganalytics.policy.rest.model.FieldValidationRule) FieldValidationRuleBuilder(com.thinkbiganalytics.policy.rest.model.FieldValidationRuleBuilder) ArrayList(java.util.ArrayList) FieldRuleProperty(com.thinkbiganalytics.policy.rest.model.FieldRuleProperty) Validator(com.thinkbiganalytics.policy.validation.Validator)

Aggregations

FieldRuleProperty (com.thinkbiganalytics.policy.rest.model.FieldRuleProperty)1 FieldValidationRule (com.thinkbiganalytics.policy.rest.model.FieldValidationRule)1 FieldValidationRuleBuilder (com.thinkbiganalytics.policy.rest.model.FieldValidationRuleBuilder)1 Validator (com.thinkbiganalytics.policy.validation.Validator)1 ArrayList (java.util.ArrayList)1