Skip to content

Instantly share code, notes, and snippets.

@jbleduigou
Created June 12, 2019 19:06
Show Gist options
  • Save jbleduigou/5a4f5b47879721335203243f5406940b to your computer and use it in GitHub Desktop.
Save jbleduigou/5a4f5b47879721335203243f5406940b to your computer and use it in GitHub Desktop.
Beer.java
package com.github.jbleduigou.beer.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
public class Beer {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private Double alcoholByVolume;
@JsonIgnore
public boolean isAlcoholFree() {
return alcoholByVolume != null && alcoholByVolume <= 0.5;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment