{code} // Programmatic mapping API // // Version ignoring the annotation parameters // The lambda file type is inferred from addConstraintImplementor class parameter mapping .addConstraintImplementor(IsFile.class, File.class).validating( (file) -> file.isFile() ); mapping .addConstraintImplementor(IsFile.class, File.class).validating( File::isFile );
// Version using annotation parameters // The lambda annotation type is inferred from addConstraintImplementor class parameter mapping .addConstraintImplementor(CheckFileType.class, File.class) .validating( (annotation, file) -> annotation.isFile() && file.isFile() ); {code}
|