-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/5.0.1.RELEASE.20231011'
- Loading branch information
Showing
60 changed files
with
222 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
rootProject.name = 'clean-core' | ||
rootProject.name = 'commons' |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package dev.root101.clean.core.test; | ||
|
||
import dev.root101.clean.core.utils.validation.ValidationFieldName; | ||
import java.util.List; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
|
||
/** | ||
* | ||
* @author Yo | ||
*/ | ||
public class Child { | ||
|
||
@NotNull | ||
@Size(max = 5) | ||
@ValidationFieldName("child_name") | ||
private String childName; | ||
|
||
@NotNull | ||
@NotEmpty | ||
@ValidationFieldName("toys") | ||
private List<Toy> toys; | ||
|
||
public Child(String childName, List<Toy> toys) { | ||
this.childName = childName; | ||
this.toys = toys; | ||
} | ||
|
||
public String getChildName() { | ||
return childName; | ||
} | ||
|
||
public void setChildName(String childName) { | ||
this.childName = childName; | ||
} | ||
|
||
public List<Toy> getToys() { | ||
return toys; | ||
} | ||
|
||
public void setToys(List<Toy> toys) { | ||
this.toys = toys; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package dev.root101.clean.core.test; | ||
|
||
import dev.root101.clean.core.utils.validation.ValidationService; | ||
import java.util.List; | ||
|
||
class Main { | ||
|
||
public static void main(String[] args) throws Exception { | ||
Parent parent = new Parent("name111", ParentType.ACTIVE, List.of(new Toy("toy name 1"))); | ||
ValidationService.validateRecursiveAndThrow(parent); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package dev.root101.clean.core.test; | ||
|
||
import dev.root101.clean.core.utils.validation.ValidationFieldName; | ||
import java.util.List; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
|
||
/** | ||
* | ||
* @author Yo | ||
*/ | ||
public class Parent { | ||
|
||
@Size(max = 5) | ||
@ValidationFieldName("parent_name") | ||
private String parentName; | ||
|
||
@ValidationFieldName("type") | ||
@NotNull | ||
private ParentType type; | ||
|
||
@ValidationFieldName("parent_toys") | ||
private List<Toy> parentToys; | ||
|
||
public Parent(String parentName, ParentType type, List<Toy> parentToys) { | ||
this.parentName = parentName; | ||
this.type = type; | ||
this.parentToys = parentToys; | ||
} | ||
|
||
public String getParentName() { | ||
return parentName; | ||
} | ||
|
||
public void setParentName(String parentName) { | ||
this.parentName = parentName; | ||
} | ||
|
||
public List<Toy> getParentToys() { | ||
return parentToys; | ||
} | ||
|
||
public void setParentToys(List<Toy> parentToys) { | ||
this.parentToys = parentToys; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package dev.root101.clean.core.test; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import dev.root101.clean.core.exceptions.NotFoundException; | ||
import dev.root101.clean.core.test.ParentType.PlatformResponse; | ||
import dev.root101.clean.core.utils.EnumMappeable; | ||
import jakarta.validation.constraints.Size; | ||
|
||
/** | ||
* | ||
* @author Yo | ||
*/ | ||
public enum ParentType implements EnumMappeable<PlatformResponse> { | ||
ACTIVE(1, "Active"), | ||
ON_HOLD(2, "on Hold"), | ||
CLOSED(3, "Closed"); | ||
|
||
public record PlatformResponse( | ||
@JsonProperty("id") | ||
int id, | ||
@JsonProperty("name") | ||
String name) { | ||
|
||
} | ||
private final int id; | ||
|
||
@Size(max = 3) | ||
private final String name; | ||
|
||
private ParentType(int id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public PlatformResponse map() { | ||
return new PlatformResponse(id, name); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getName(); | ||
} | ||
|
||
public static ParentType resolve(int id) { | ||
for (ParentType value : ParentType.values()) { | ||
if (value.getId() == id) { | ||
return value; | ||
} | ||
} | ||
throw new NotFoundException("No Parent Type found with id '%s'.".formatted(id)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package dev.root101.clean.core.test; | ||
|
||
import jakarta.validation.constraints.Size; | ||
|
||
/** | ||
* | ||
* @author Yo | ||
*/ | ||
public class Toy { | ||
|
||
@Size(max = 5) | ||
//@ValidationFieldName("toy_name") | ||
private String toyName; | ||
|
||
public Toy(String toyName) { | ||
this.toyName = toyName; | ||
} | ||
|
||
public String getToyName() { | ||
return toyName; | ||
} | ||
|
||
public void setToyName(String toyName) { | ||
this.toyName = toyName; | ||
} | ||
|
||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.