Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

RepositoryEvent.java 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package org.apache.archiva.repository;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import java.time.LocalDateTime;
  21. /**
  22. * Repository event. Repository events are used for providing information about repository changes.
  23. *
  24. * @param <T>
  25. */
  26. public class RepositoryEvent<T> {
  27. final EventType type;
  28. final Repository repo;
  29. final T value;
  30. final T oldValue;
  31. final LocalDateTime instant;
  32. public RepositoryEvent(EventType type, Repository repo, T oldValue, T value) {
  33. this.type = type;
  34. this.repo = repo;
  35. this.value = value;
  36. this.oldValue = oldValue;
  37. this.instant = LocalDateTime.now();
  38. }
  39. public interface EventType {
  40. String name();
  41. }
  42. public EventType getType() {
  43. return type;
  44. };
  45. public Repository getRepository() {
  46. return repo;
  47. };
  48. public T getValue() {
  49. return value;
  50. }
  51. public T getOldValue() {
  52. return oldValue;
  53. }
  54. public LocalDateTime getInstant() {
  55. return instant;
  56. }
  57. }