Skip to content

Commit e4a4226

Browse files
authored
Version 3.0.0 released (#1)
1 parent ee91463 commit e4a4226

20 files changed

+870
-0
lines changed

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
.idea
8+
*.iws
9+
*.iml
10+
*.ipr
11+
12+
### Eclipse ###
13+
.apt_generated
14+
.classpath
15+
.factorypath
16+
.project
17+
.settings
18+
.springBeans
19+
.sts4-cache
20+
21+
### NetBeans ###
22+
/nbproject/private/
23+
/nbbuild/
24+
/dist/
25+
/nbdist/
26+
/.nb-gradle/
27+
build/
28+
!**/src/main/**/build/
29+
!**/src/test/**/build/
30+
31+
### VS Code ###
32+
.vscode/
33+
34+
### Mac OS ###
35+
.DS_Store

pom.xml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>io.github.rajparsaniya</groupId>
8+
<artifactId>spring-boot-validation</artifactId>
9+
<version>3.0.0</version>
10+
<packaging>jar</packaging>
11+
12+
<name>spring-boot-validation</name>
13+
<description>The Spring Boot Validation library provides a collection of reusable custom validation annotations and
14+
constraint validators tailored for Spring Boot applications. Built on top of spring-boot-starter-validation, the
15+
library enables developers to enforce domain-specific rules with minimal boilerplate code.
16+
</description>
17+
<url>https://github.com/RajParsaniya/spring-boot-validation</url>
18+
19+
<licenses>
20+
<license>
21+
<name>MIT License</name>
22+
<url>http://www.opensource.org/licenses/mit-license.php</url>
23+
</license>
24+
</licenses>
25+
26+
<properties>
27+
<maven.compiler.source>17</maven.compiler.source>
28+
<maven.compiler.target>17</maven.compiler.target>
29+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
30+
</properties>
31+
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-starter-validation</artifactId>
36+
<version>3.0.0</version>
37+
<scope>provided</scope>
38+
</dependency>
39+
</dependencies>
40+
41+
<developers>
42+
<developer>
43+
<name>Raj Parsaniya</name>
44+
<email>rajparsaniya55@gmail.com</email>
45+
<organization>io.github.rajparsaniya</organization>
46+
<organizationUrl>https://github.com/RajParsaniya</organizationUrl>
47+
</developer>
48+
</developers>
49+
50+
<scm>
51+
<connection>scm:git:git://github.com/RajParsaniya/spring-boot-validation.git</connection>
52+
<developerConnection>scm:git:ssh://github.com:RajParsaniya/spring-boot-validation.git</developerConnection>
53+
<url>https://github.com/RajParsaniya/spring-boot-validation</url>
54+
</scm>
55+
56+
<build>
57+
<plugins>
58+
<!-- Compiler plugin -->
59+
<plugin>
60+
<groupId>org.apache.maven.plugins</groupId>
61+
<artifactId>maven-compiler-plugin</artifactId>
62+
<version>3.11.0</version>
63+
<configuration>
64+
<source>${maven.compiler.source}</source>
65+
<target>${maven.compiler.target}</target>
66+
</configuration>
67+
</plugin>
68+
69+
<!-- Source Jar plugin -->
70+
<plugin>
71+
<groupId>org.apache.maven.plugins</groupId>
72+
<artifactId>maven-source-plugin</artifactId>
73+
<version>2.2.1</version>
74+
<executions>
75+
<execution>
76+
<id>attach-sources</id>
77+
<goals>
78+
<goal>jar-no-fork</goal>
79+
</goals>
80+
</execution>
81+
</executions>
82+
</plugin>
83+
84+
<!-- Javadoc Jar plugin -->
85+
<plugin>
86+
<groupId>org.apache.maven.plugins</groupId>
87+
<artifactId>maven-javadoc-plugin</artifactId>
88+
<version>2.9.1</version>
89+
<configuration>
90+
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
91+
</configuration>
92+
<executions>
93+
<execution>
94+
<id>attach-javadocs</id>
95+
<goals>
96+
<goal>jar</goal>
97+
</goals>
98+
</execution>
99+
</executions>
100+
</plugin>
101+
102+
<!-- GPG Signing plugin -->
103+
<plugin>
104+
<groupId>org.apache.maven.plugins</groupId>
105+
<artifactId>maven-gpg-plugin</artifactId>
106+
<version>1.5</version>
107+
<executions>
108+
<execution>
109+
<id>sign-artifacts</id>
110+
<phase>verify</phase>
111+
<goals>
112+
<goal>sign</goal>
113+
</goals>
114+
<configuration>
115+
<keyname>0x71E86441</keyname>
116+
<gpgArguments>
117+
<arg>--pinentry-mode</arg>
118+
<arg>loopback</arg>
119+
</gpgArguments>
120+
</configuration>
121+
</execution>
122+
</executions>
123+
</plugin>
124+
125+
<!-- Central Publishing plugin -->
126+
<plugin>
127+
<groupId>org.sonatype.central</groupId>
128+
<artifactId>central-publishing-maven-plugin</artifactId>
129+
<version>0.3.0</version>
130+
<extensions>true</extensions>
131+
<configuration>
132+
<publishingServerId>central</publishingServerId>
133+
<tokenAuth>true</tokenAuth>
134+
</configuration>
135+
</plugin>
136+
</plugins>
137+
</build>
138+
139+
</project>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package io.github.rajparsaniya.annotation;
2+
3+
import io.github.rajparsaniya.validator.EndsWithValidator;
4+
import jakarta.validation.Constraint;
5+
import jakarta.validation.Payload;
6+
7+
import java.lang.annotation.Documented;
8+
import java.lang.annotation.ElementType;
9+
import java.lang.annotation.Retention;
10+
import java.lang.annotation.RetentionPolicy;
11+
import java.lang.annotation.Target;
12+
13+
/**
14+
* Annotation to validate that a string ends with the specified suffix.
15+
*
16+
* @author Raj Parsaniya
17+
* @since 3.0.0
18+
*/
19+
@Documented
20+
@Constraint(validatedBy = EndsWithValidator.class)
21+
@Target({ElementType.FIELD, ElementType.PARAMETER})
22+
@Retention(RetentionPolicy.RUNTIME)
23+
public @interface EndsWith {
24+
25+
/**
26+
* The required suffix the string must end with.
27+
*
28+
* @return the suffix value.
29+
* @since 3.0.0
30+
*/
31+
String value();
32+
33+
/**
34+
* The error message that will be shown when validation fails.
35+
*
36+
* @return the validation error message.
37+
* @since 3.0.0
38+
*/
39+
String message() default "must end with {value}";
40+
41+
/**
42+
* Allows the specification of validation groups.
43+
*
44+
* @return the validation groups.
45+
* @since 3.0.0
46+
*/
47+
Class<?>[] groups() default {};
48+
49+
/**
50+
* Can be used by clients to assign custom payload objects to a constraint.
51+
*
52+
* @return the payload.
53+
* @since 3.0.0
54+
*/
55+
Class<? extends Payload>[] payload() default {};
56+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package io.github.rajparsaniya.annotation;
2+
3+
import io.github.rajparsaniya.validator.NoSpecialCharactersValidator;
4+
import jakarta.validation.Constraint;
5+
import jakarta.validation.Payload;
6+
7+
import java.lang.annotation.Documented;
8+
import java.lang.annotation.ElementType;
9+
import java.lang.annotation.Retention;
10+
import java.lang.annotation.RetentionPolicy;
11+
import java.lang.annotation.Target;
12+
13+
/**
14+
* Annotation to validate that a string contains only alphanumeric characters
15+
* (letters and digits) and does not include special characters.
16+
*
17+
* @author Raj Parsaniya
18+
* @since 3.0.0
19+
*/
20+
@Documented
21+
@Constraint(validatedBy = NoSpecialCharactersValidator.class)
22+
@Target({ElementType.FIELD, ElementType.PARAMETER})
23+
@Retention(RetentionPolicy.RUNTIME)
24+
public @interface NoSpecialCharacters {
25+
26+
/**
27+
* The error message that will be shown when validation fails.
28+
*
29+
* @return the validation error message.
30+
* @since 3.0.0
31+
*/
32+
String message() default "must not contain special characters";
33+
34+
/**
35+
* Allows the specification of validation groups.
36+
*
37+
* @return the validation groups.
38+
* @since 3.0.0
39+
*/
40+
Class<?>[] groups() default {};
41+
42+
/**
43+
* Can be used by clients to assign custom payload objects to a constraint.
44+
*
45+
* @return the payload.
46+
* @since 3.0.0
47+
*/
48+
Class<? extends Payload>[] payload() default {};
49+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package io.github.rajparsaniya.annotation;
2+
3+
import io.github.rajparsaniya.validator.NumericOnlyValidator;
4+
import jakarta.validation.Constraint;
5+
import jakarta.validation.Payload;
6+
7+
import java.lang.annotation.Documented;
8+
import java.lang.annotation.ElementType;
9+
import java.lang.annotation.Retention;
10+
import java.lang.annotation.RetentionPolicy;
11+
import java.lang.annotation.Target;
12+
13+
/**
14+
* Annotation to validate that a string contains only numeric digits (0–9).
15+
*
16+
* @author Raj Parsaniya
17+
* @since 3.0.0
18+
*/
19+
@Documented
20+
@Constraint(validatedBy = NumericOnlyValidator.class)
21+
@Target({ElementType.FIELD, ElementType.PARAMETER})
22+
@Retention(RetentionPolicy.RUNTIME)
23+
public @interface NumericOnly {
24+
25+
/**
26+
* The error message that will be shown when validation fails.
27+
*
28+
* @return the validation error message.
29+
* @since 3.0.0
30+
*/
31+
String message() default "must contain only digits";
32+
33+
/**
34+
* Allows the specification of validation groups.
35+
*
36+
* @return the validation groups.
37+
* @since 3.0.0
38+
*/
39+
Class<?>[] groups() default {};
40+
41+
/**
42+
* Can be used by clients to assign custom payload objects to a constraint.
43+
*
44+
* @return the payload.
45+
* @since 3.0.0
46+
*/
47+
Class<? extends Payload>[] payload() default {};
48+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package io.github.rajparsaniya.annotation;
2+
3+
import io.github.rajparsaniya.validator.StartsWithValidator;
4+
import jakarta.validation.Constraint;
5+
import jakarta.validation.Payload;
6+
7+
import java.lang.annotation.Documented;
8+
import java.lang.annotation.ElementType;
9+
import java.lang.annotation.Retention;
10+
import java.lang.annotation.RetentionPolicy;
11+
import java.lang.annotation.Target;
12+
13+
/**
14+
* Annotation to validate that a string starts with the specified prefix.
15+
*
16+
* @author Raj Parsaniya
17+
* @since 3.0.0
18+
*/
19+
@Documented
20+
@Constraint(validatedBy = StartsWithValidator.class)
21+
@Target({ElementType.FIELD, ElementType.PARAMETER})
22+
@Retention(RetentionPolicy.RUNTIME)
23+
public @interface StartsWith {
24+
25+
/**
26+
* The required prefix the string must start with.
27+
*
28+
* @return the prefix.
29+
* @since 3.0.0
30+
*/
31+
String value();
32+
33+
/**
34+
* The error message that will be shown when validation fails.
35+
*
36+
* @return the validation error message.
37+
* @since 3.0.0
38+
*/
39+
String message() default "must start with {value}";
40+
41+
/**
42+
* Allows the specification of validation groups.
43+
*
44+
* @return the validation groups.
45+
* @since 3.0.0
46+
*/
47+
Class<?>[] groups() default {};
48+
49+
/**
50+
* Can be used by clients to assign custom payload objects to a constraint.
51+
*
52+
* @return the payload.
53+
* @since 3.0.0
54+
*/
55+
Class<? extends Payload>[] payload() default {};
56+
}

0 commit comments

Comments
 (0)