Line data Source code
1 : // Copyright (C) 2014 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.extensions.common; 16 : 17 : import java.sql.Timestamp; 18 : import java.time.Instant; 19 : import java.util.Objects; 20 : 21 105 : public class GitPerson { 22 : public String name; 23 : public String email; 24 : 25 : // TODO(issue-15508): Migrate timestamp fields in *Info/*Input classes from type Timestamp to 26 : // Instant 27 : public Timestamp date; 28 : 29 : public int tz; 30 : 31 : // TODO(issue-15508): Migrate timestamp fields in *Info/*Input classes from type Timestamp to 32 : // Instant 33 : @SuppressWarnings("JdkObsolete") 34 : public void setDate(Instant when) { 35 105 : date = Timestamp.from(when); 36 105 : } 37 : 38 : @Override 39 : public boolean equals(Object o) { 40 1 : if (!(o instanceof GitPerson)) { 41 0 : return false; 42 : } 43 1 : GitPerson p = (GitPerson) o; 44 1 : return Objects.equals(name, p.name) 45 1 : && Objects.equals(email, p.email) 46 1 : && Objects.equals(date, p.date) 47 : && tz == p.tz; 48 : } 49 : 50 : @Override 51 : public int hashCode() { 52 0 : return Objects.hash(name, email, date, tz); 53 : } 54 : 55 : @Override 56 : public String toString() { 57 0 : return getClass().getSimpleName() 58 : + "{name=" 59 : + name 60 : + ", email=" 61 : + email 62 : + ", date=" 63 : + date 64 : + ", tz=" 65 : + tz 66 : + "}"; 67 : } 68 : }