Skip to content

This is a custom validator based on Jakarta validation-api, inspired by org.hibernate.validator.constraints.ScriptAssert.

License

Notifications You must be signed in to change notification settings

ro4/spel-validation

Repository files navigation

SpEL Validation

Scrutinizer Code QualityCode CoverageBuild Status

This is a custom validator based on Jakarta validation-api, inspired by org.hibernate.validator.constraints.ScriptAssert.

The source code is so tiny, you can read it as document :)

Example

@SpELAssert("#p.maxAge > 100") // repeatable annotation@SpELAssert(expression = "#_.maxAge > 100", alias = "_") // alias support@SpELAssert( expression ={"#p.minAge < #p.maxAge", "and #p.minAge > 10"}, // multi-line expressionsmessage = "Max must greater than min age, min age must greater than 10", reportOn = "minAge" ) publicclassConfig{@SpELAssert("@springBean.method(#p)") // spring bean invokeprivateStringname; privateIntegerminAge; privateIntegermaxAge}

About

This is a custom validator based on Jakarta validation-api, inspired by org.hibernate.validator.constraints.ScriptAssert.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages