Person.java
001 /*
002  * SPDX-License-Identifier: Apache-2.0
003  *
004  * Copyright 2020-2022 Agorapulse.
005  *
006  * Licensed under the Apache License, Version 2.0 (the "License");
007  * you may not use this file except in compliance with the License.
008  * You may obtain a copy of the License at
009  *
010  *     https://www.apache.org/licenses/LICENSE-2.0
011  *
012  * Unless required by applicable law or agreed to in writing, software
013  * distributed under the License is distributed on an "AS IS" BASIS,
014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015  * See the License for the specific language governing permissions and
016  * limitations under the License.
017  */
018 package com.agorapulse.micronaut.bigquery.tck;
019 
020 import io.micronaut.core.annotation.Introspected;
021 
022 import java.time.Instant;
023 import java.util.Objects;
024 
025 // tag::main-code[]
026 @Introspected                                                                           // <1>
027 public class Person {
028 
029     private long id;
030     private boolean enabled = true;
031     private Instant created = Instant.now();
032     private double score = 1.0;
033     private String firstName;
034     private String lastName;
035     private String email;
036     private Role role;
037 
038     // end::main-code[]
039 
040     public long getId() {
041         return id;
042     }
043 
044     public void setId(long id) {
045         this.id = id;
046     }
047 
048     public String getFirstName() {
049         return firstName;
050     }
051 
052     public void setFirstName(String firstName) {
053         this.firstName = firstName;
054     }
055 
056     public String getLastName() {
057         return lastName;
058     }
059 
060     public void setLastName(String lastName) {
061         this.lastName = lastName;
062     }
063 
064     public String getEmail() {
065         return email;
066     }
067 
068     public void setEmail(String email) {
069         this.email = email;
070     }
071 
072     public Role getRole() {
073         return role;
074     }
075 
076     public void setRole(Role role) {
077         this.role = role;
078     }
079 
080     public boolean isEnabled() {
081         return enabled;
082     }
083 
084     public void setEnabled(boolean enabled) {
085         this.enabled = enabled;
086     }
087 
088     public Instant getCreated() {
089         return created;
090     }
091 
092     public void setCreated(Instant created) {
093         this.created = created;
094     }
095 
096     public double getScore() {
097         return score;
098     }
099 
100     public void setScore(double score) {
101         this.score = score;
102     }
103 
104     @Override
105     public boolean equals(Object o) {
106         if (this == o) {
107             return true;
108         }
109 
110         if (o == null || getClass() != o.getClass()) {
111             return false;
112         }
113 
114         Person person = (Persono;
115         return id == person.id
116             && enabled == person.enabled
117             && Double.compare(person.score, score== 0
118             && Objects.equals(created, person.created)
119             && Objects.equals(firstName, person.firstName)
120             && Objects.equals(lastName, person.lastName)
121             && Objects.equals(email, person.email)
122             && role == person.role;
123     }
124 
125     @Override
126     public int hashCode() {
127         return Objects.hash(id, enabled, created, score, firstName, lastName, email, role);
128     }
129 }