1 package org.apache.archiva.repository.events;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import java.time.LocalDateTime;
24 public class Event<O> {
29 final LocalDateTime instant;
31 public <OO extends O> Event(EventType type, OO originator) {
32 this.originator = originator;
34 this.instant = LocalDateTime.now();
37 private <OO> Event(Event<OO> previous, O originator) {
38 this.previous = previous;
39 this.originator = originator;
40 this.type = previous.getType();
41 this.instant = previous.getInstant();
44 public EventType getType() {
48 public LocalDateTime getInstant() {
52 public O getOriginator() {
56 public <NO> Event<NO> recreate(NO newOrigin) {
57 return new Event(this, newOrigin);
60 public Event getPreviousEvent() {
64 public boolean hasPreviousEvent() {
65 return previous!=null;