All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl._42.jarb.constraint.metadata.enhance.NotNullPropertyConstraintEnhancer Maven / Gradle / Ivy

There is a newer version: 7.0.0
Show newest version
package nl._42.jarb.constraint.metadata.enhance;

import nl._42.jarb.constraint.metadata.PropertyConstraintDescription;
import nl._42.jarb.utils.bean.Annotations;

/**
 * Whenever a property is annotated as @NotNull, it is required.
 * 
 * @author Jeroen van Schagen
 * @since 31-05-2011
 */
public class NotNullPropertyConstraintEnhancer implements PropertyConstraintEnhancer {

    @Override
    public void enhance(PropertyConstraintDescription description) {
        if (Annotations.hasAnnotation(description.toReference(), javax.validation.constraints.NotNull.class)) {
            description.setRequired(true);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy