Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
58 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
23 changes: 23 additions & 0 deletions
23
validation/src/main/java/hello/itemservice/web/validation/form/ItemSaveForm.java
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,23 @@ | ||
package hello.itemservice.web.validation.form; | ||
|
||
import lombok.Data; | ||
import org.hibernate.validator.constraints.Range; | ||
|
||
import javax.validation.constraints.Max; | ||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
|
||
@Data | ||
public class ItemSaveForm { | ||
|
||
@NotBlank | ||
private String itemName; | ||
|
||
@NotNull | ||
@Range(min = 1000, max = 1000000) | ||
private Integer price; | ||
|
||
@NotNull | ||
@Max(value = 9999) | ||
private Integer quantity; | ||
} |
24 changes: 24 additions & 0 deletions
24
validation/src/main/java/hello/itemservice/web/validation/form/ItemUpdateForm.java
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,24 @@ | ||
package hello.itemservice.web.validation.form; | ||
|
||
import lombok.Data; | ||
import org.hibernate.validator.constraints.Range; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
|
||
@Data | ||
public class ItemUpdateForm { | ||
|
||
@NotNull | ||
private Long id; | ||
|
||
@NotBlank | ||
private String itemName; | ||
|
||
@NotNull | ||
@Range(min = 1000, max = 1000000) | ||
private Integer price; | ||
|
||
//수정에서는 수량은 자유롭게 변경할 수 있다. | ||
private Integer quantity; | ||
} |