Last active
April 21, 2020 17:51
-
-
Save Daniel-Dos/a40371fe26318a5185a2f57fa96fa443 to your computer and use it in GitHub Desktop.
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
package com.medium.danieldiasjava.micronaut.basic.model; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
import javax.validation.constraints.Min; | |
import javax.validation.constraints.NotEmpty; | |
import javax.validation.constraints.Size; | |
import io.micronaut.core.annotation.Introspected; | |
@Entity | |
@Introspected | |
public class Person { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private Long id; | |
@NotEmpty(message = "can not be empty") | |
@Size(min = 1, max = 20) | |
private String name; | |
@Min(18) | |
private int age; | |
public Person(String name, int age) { | |
this.name = name; | |
this.age = age; | |
} | |
public Person() {} | |
public int getAge() { | |
return age; | |
} | |
public void setAge(int age) { | |
this.age = age; | |
} | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
public Long getId() { | |
return id; | |
} | |
public void setId(Long id) { | |
this.id = id; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment