Skip to content

Easy attribute, field and object validation library for Java.

License

Notifications You must be signed in to change notification settings

dkvarshney/bouncer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bouncer

A simple but powerful library for validations in Java.

Example 1: Attribute Validations

String something = "hello";			
Bouncer.makeSure("Attribute", something)
	.isNotBlank()
	.isNotLongerThan(10)
	.isNotShorterThan(5)
      	... many more.

Example 2: Object Validations

class Employee {		
	@StringLengthRange(minLength = 4)
	@NotNull
	String id;
		
	@StringLengthRange(minLength = 4, maxLength = 64)
	@NotNull
	String name;
		
	@StringAnyOf(values = {"IT", "HR", "SALES"})
	@NotNull
	String department;
		
	@StringValidUrl
	String profileUrl;
}

And the validation:

Employee emp = something.
Bouncer.validate(emp);

Releases

No releases published

Packages

 
 
 

Languages