Line data Source code
1 : // Copyright (C) 2015 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.server.extensions.events; 16 : 17 : import com.google.gerrit.extensions.api.changes.NotifyHandling; 18 : import com.google.gerrit.extensions.common.AccountInfo; 19 : import com.google.gerrit.extensions.common.ChangeInfo; 20 : import com.google.gerrit.extensions.events.ChangeEvent; 21 : import java.time.Instant; 22 : 23 : /** Base class for all change events. */ 24 : public abstract class AbstractChangeEvent implements ChangeEvent { 25 : private final ChangeInfo changeInfo; 26 : private final AccountInfo who; 27 : private final Instant when; 28 : private final NotifyHandling notify; 29 : 30 : protected AbstractChangeEvent( 31 100 : ChangeInfo change, AccountInfo who, Instant when, NotifyHandling notify) { 32 100 : this.changeInfo = change; 33 100 : this.who = who; 34 100 : this.when = when; 35 100 : this.notify = notify; 36 100 : } 37 : 38 : @Override 39 : public ChangeInfo getChange() { 40 100 : return changeInfo; 41 : } 42 : 43 : @Override 44 : public AccountInfo getWho() { 45 95 : return who; 46 : } 47 : 48 : @Override 49 : public Instant getWhen() { 50 0 : return when; 51 : } 52 : 53 : @Override 54 : public NotifyHandling getNotify() { 55 0 : return notify; 56 : } 57 : }