Search in sources :

Example 1 with MethodType

use of jakarta.validation.metadata.MethodType in project hibernate-validator by hibernate.

the class BeanDescriptorImpl method getConstrainedMethods.

@Override
public Set<MethodDescriptor> getConstrainedMethods(MethodType methodType, MethodType... methodTypes) {
    boolean includeGetters = MethodType.GETTER.equals(methodType);
    boolean includeNonGetters = MethodType.NON_GETTER.equals(methodType);
    if (methodTypes != null) {
        for (MethodType type : methodTypes) {
            if (MethodType.GETTER.equals(type)) {
                includeGetters = true;
            }
            if (MethodType.NON_GETTER.equals(type)) {
                includeNonGetters = true;
            }
        }
    }
    Set<MethodDescriptor> matchingMethodDescriptors = newHashSet();
    for (ExecutableDescriptorImpl constrainedMethod : constrainedMethods.values()) {
        boolean addToSet = false;
        if ((constrainedMethod.isGetter() && includeGetters) || (!constrainedMethod.isGetter() && includeNonGetters)) {
            addToSet = true;
        }
        if (addToSet) {
            matchingMethodDescriptors.add(constrainedMethod);
        }
    }
    return matchingMethodDescriptors;
}
Also used : MethodType(jakarta.validation.metadata.MethodType) MethodDescriptor(jakarta.validation.metadata.MethodDescriptor)

Aggregations

MethodDescriptor (jakarta.validation.metadata.MethodDescriptor)1 MethodType (jakarta.validation.metadata.MethodType)1