Skip to content

Commit 08b2cd7

Browse files
authored
Merge pull request #7 from ApamateSoft/develop
Develop
2 parents 5c489e9 + 10aee3e commit 08b2cd7

File tree

126 files changed

+3969
-1034
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+3969
-1034
lines changed

README.md

+410-341
Large diffs are not rendered by default.

pom.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<groupId>io.github.ApamateSoft</groupId>
1111
<artifactId>Validator</artifactId>
12-
<version>1.2.0</version>
12+
<version>1.3.0</version>
1313
<packaging>jar</packaging>
1414

1515
<name>Validator</name>
@@ -72,6 +72,9 @@
7272
<serverId>ossrh</serverId>
7373
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
7474
<autoReleaseAfterClose>true</autoReleaseAfterClose>
75+
<tags>
76+
<category></category>
77+
</tags>
7578
</configuration>
7679
</plugin>
7780

src/main/java/io/github/ApamateSoft/validator/Validator.java

+587-176
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Compare the value of this String with the value of the variable that matches the name set in the compareWith
10+
* attribute
11+
*/
12+
@Retention(RetentionPolicy.RUNTIME)
13+
@Target(ElementType.FIELD)
14+
public @interface Compare {
15+
/**
16+
* @return Name of the variable, with which the value is compared
17+
*/
18+
String compareWith();
19+
/**
20+
* @return Error message
21+
*/
22+
String message() default "";
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the String to evaluate matches the specified date format
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface Date {
14+
/**
15+
* @return Describing the date and time format
16+
*/
17+
String format();
18+
19+
/**
20+
* @return Error message
21+
*/
22+
String message() default "";
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the String has an email format
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface Email {
14+
/**
15+
* @return Error message
16+
*/
17+
String message() default "";
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the entered date has not expired <br/>
10+
* <b>Warning:</b> This annotation makes use of the current date of the device <br />
11+
* <b>Note:</b> It is recommended to implement the {@Date} annotation first
12+
*/
13+
@Retention(RetentionPolicy.RUNTIME)
14+
@Target(ElementType.FIELD)
15+
public @interface ExpirationDate {
16+
/**
17+
* @return Describing the date and time format
18+
*/
19+
String format();
20+
21+
/**
22+
* @return Error message
23+
*/
24+
String message() default "";
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the String is a link with http format
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface HttpLink {
14+
/**
15+
* @return Error message
16+
*/
17+
String message() default "";
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the String is a link with https format
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface HttpsLink {
14+
/**
15+
* @return Error message
16+
*/
17+
String message() default "";
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the String is an ip format
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface Ip {
14+
/**
15+
* @return Error message
16+
*/
17+
String message() default "";
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the String is an ipv4 format
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface Ipv4 {
14+
/**
15+
* @return Error message
16+
*/
17+
String message() default "";
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the String is an ipv6 format
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface Ipv6 {
14+
/**
15+
* @return Error message
16+
*/
17+
String message() default "";
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the String has an exact length of characters
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface Length {
14+
/**
15+
* @return character length
16+
*/
17+
int length();
18+
19+
/**
20+
* @return Error message
21+
*/
22+
String message() default "";
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the String is a link format
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface Link {
14+
/**
15+
* @return Error message
16+
*/
17+
String message() default "";
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the length of the String is not greater than the condition
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface MaxLength {
14+
/**
15+
* @return Maximum character length
16+
*/
17+
int max();
18+
19+
/**
20+
* @return Error message
21+
*/
22+
String message() default "";
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the value of the String is not greater than the condition <br />
10+
* <b>Note:</b> It is recommended to implement the {@Number} annotation first
11+
*/
12+
@Retention(RetentionPolicy.RUNTIME)
13+
@Target(ElementType.FIELD)
14+
public @interface MaxValue {
15+
16+
/**
17+
* @return Maximum value
18+
*/
19+
double max();
20+
21+
/**
22+
* @return Error message
23+
*/
24+
String message() default "";
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the period from the entered date to the current date is greater than or equal to a minimum age <br/>
10+
* <b>Warning:</b> This annotation makes use of the current date of the device <br />
11+
* <b>Note:</b> It is recommended to implement the {@Date} annotation first
12+
*/
13+
@Retention(RetentionPolicy.RUNTIME)
14+
@Target(ElementType.FIELD)
15+
public @interface MinAge {
16+
17+
/**
18+
* @return Describing the date and time format
19+
*/
20+
String format();
21+
22+
/**
23+
* @return Minimum age
24+
*/
25+
int age();
26+
27+
/**
28+
* @return Error message
29+
*/
30+
String message() default "";
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the length of the String is not less than the condition
10+
*/
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target(ElementType.FIELD)
13+
public @interface MinLength {
14+
15+
/**
16+
* @return Minimum character length
17+
*/
18+
int min();
19+
20+
/**
21+
* @return Error message
22+
*/
23+
String message() default "";
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.github.ApamateSoft.validator.annotations;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Validates that the value of the String is not less than the condition <br />
10+
* <b>Note:</b> It is recommended to implement the {@Number} annotation first
11+
*/
12+
@Retention(RetentionPolicy.RUNTIME)
13+
@Target(ElementType.FIELD)
14+
public @interface MinValue {
15+
/**
16+
* @return Minimum value
17+
*/
18+
double min();
19+
20+
/**
21+
* @return Error message
22+
*/
23+
String message() default "";
24+
}

0 commit comments

Comments
 (0)