-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathProduct.java
More file actions
57 lines (45 loc) · 1.3 KB
/
Product.java
File metadata and controls
57 lines (45 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.example.demo.Model;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
import jakarta.validation.constraints.Size;
public class Product {
@NotBlank(message = "Name cannot be blank")
@Size(min=3,message = "Name's size cannot be more than 3")
private String name;
@Positive(message = "Price must be positive")
private double price;
@NotBlank(message = "Category cannot be blank")
private String Category;
@Positive(message = "Price must be positive")
private int quantity;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getCategory() {
return Category;
}
public void setCategory(String category) {
Category = category;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public Product(String name, double price, int quantity, String category) {
this.name = name;
this.price = price;
this.quantity = quantity;
Category = category;
}
}