Skip to content

Commit

Permalink
Criação classe CategoriaModel
Browse files Browse the repository at this point in the history
  • Loading branch information
Muriloabreu committed May 1, 2023
1 parent e0be28a commit c032ba6
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions src/main/java/com/api/controleestoque/models/CategoriaModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package com.api.controleestoque.models;

import java.util.Objects;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity
@Table(name = "TB_CATEGORIAS")
public class CategoriaModel {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(nullable = false)
private String nome;
@Column(nullable = false)
private String descricao;

/* Construtor */

public CategoriaModel() {
super();
}

public CategoriaModel(Long id, String nome, String descricao) {
super();
this.id = id;
this.nome = nome;
this.descricao = descricao;
}


/* Métodos Acessores */

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getNome() {
return nome;
}

public void setNome(String nome) {
this.nome = nome;
}

public String getDescricao() {
return descricao;
}

public void setDescricao(String descricao) {
this.descricao = descricao;
}

@Override
public String toString() {
return "CategoriaModel [id=" + id + ", nome=" + nome + ", descricao=" + descricao + "]";
}

@Override
public int hashCode() {
return Objects.hash(descricao, id, nome);
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CategoriaModel other = (CategoriaModel) obj;
return Objects.equals(descricao, other.descricao) && Objects.equals(id, other.id)
&& Objects.equals(nome, other.nome);
}





}

0 comments on commit c032ba6

Please sign in to comment.