A lightweight, annotation-driven Java validation library with zero dependencies.
Easily validate your POJOs using simple annotations like @NotNull, @Min, @Max, @Pattern, @Email, and @Length.
More features will be integrated soon.
- Annotation-based validation — simple and clear
- Supported annotations:
@NotNull— null check@Min/@Max— numeric boundaries@Pattern— regex pattern validation@Email— email format validation@Length— string length constraints@NotBlank— string null, empty and only whitespace check@Pastand@Future— date check
- Performance optimized — reflection access is cached
- Easy integration — just annotate your POJOs and call the validator
- Open source — community-driven and extendable
public class UserDto {
@NotNull(message = "Email cannot be null")
@Email(message = "Email format is invalid")
private String email;
@Min(value = 18, message = "Age must be at least 18")
@Max(value = 99, message = "Age must be less than 100")
private Integer age;
@Length(min = 2, max = 3, message = "Country code length must be between 2 and 3")
private String countryCode;
// getters and setters
}SlimValidator validator = new SlimValidator();
UserDto userDto = new UserDto();
userDto.setAge(12);
userDto.setCountryCode("US");
userDto.setEmail("email@example.com");
validator.validate(userDto); // throws ValidationException on failure- Maven (Latest Version)
<dependency>
<groupId>io.github.arasdenizhan</groupId>
<artifactId>slim-validator</artifactId>
<version>1.2.0</version>
</dependency>- Gradle (Latest Version)
implementation group: 'io.github.arasdenizhan', name: 'slim-validator', version: '1.2.0'
- Easily add new annotations and validation strategies
- Extensible architecture based on
StrategyFactory - Reflection caching for optimal performance
The full API documentation is available at:
Apache License 2.0 (Open source and free to use)
Pull requests and issues are welcome!
Denizhan Aras — github.com/arasdenizhan
