001/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*- 002 * 003 * Copyright © 2017 MicroBean. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 014 * implied. See the License for the specific language governing 015 * permissions and limitations under the License. 016 */ 017package org.microbean.helm.maven; 018 019import java.io.Serializable; // for javadoc only 020 021import java.util.EventObject; // for javadoc only 022import java.util.Objects; 023 024import hapi.services.tiller.Tiller.ListReleasesResponseOrBuilder; 025 026/** 027 * An {@link AbstractReleaseEvent} describing a discovery of a <a 028 * href="https://docs.helm.sh/glossary/#release">Helm release</a> 029 * performed by a {@link ListReleasesMojo} instance. 030 * 031 * @author <a href="https://about.me/lairdnelson" 032 * target="_parent">Laird Nelson</a> 033 * 034 * @see ReleaseDiscoveryListener 035 * 036 * @see ListReleasesMojo 037 */ 038public class ReleaseDiscoveryEvent extends AbstractReleaseEvent { 039 040 041 /* 042 * Static fields. 043 */ 044 045 046 /** 047 * The version of this class for {@linkplain Serializable 048 * serialization} purposes. 049 */ 050 private static final long serialVersionUID = 1L; 051 052 053 /* 054 * Instance fields. 055 */ 056 057 058 /** 059 * The {@link 060 * hapi.services.tiller.Tiller.ListReleasesResponseOrBuilder} 061 * describing the release discovery. 062 * 063 * <p>This field will never be {@code null}.</p> 064 * 065 * @see #ReleaseDiscoveryEvent(ListReleasesMojo, 066 * hapi.services.tiller.Tiller.ListReleasesResponseOrBuilder) 067 */ 068 private final ListReleasesResponseOrBuilder listReleasesResponseOrBuilder; 069 070 071 /* 072 * Constructors. 073 */ 074 075 076 /** 077 * Creates a new {@link ReleaseDiscoveryEvent}. 078 * 079 * @param source the {@link ListReleasesMojo} responsible for 080 * retrieving the release; must not be {@code null} 081 * 082 * @param listReleasesResponseOrBuilder the {@link 083 * hapi.services.tiller.Tiller.ListReleasesResponseOrBuilder} 084 * describing the release retrieval; must not be {@code null} 085 * 086 * @exception IllegalArgumentException if {@code source} is {@code 087 * null}; thrown by the {@link EventObject#EventObject(Object)} 088 * constructor 089 * 090 * @exception NullPointerException if {@code 091 * listReleasesResponseOrBuilder} is {@code null} 092 */ 093 public ReleaseDiscoveryEvent(final ListReleasesMojo source, final ListReleasesResponseOrBuilder listReleasesResponseOrBuilder) { 094 super(source); 095 Objects.requireNonNull(listReleasesResponseOrBuilder); 096 this.listReleasesResponseOrBuilder = listReleasesResponseOrBuilder; 097 } 098 099 100 /* 101 * Instance methods. 102 */ 103 104 105 /** 106 * Returns the {@link 107 * hapi.services.tiller.Tiller.ListReleasesResponseOrBuilder} 108 * implementation representing the release retrieval. 109 * 110 * <p>This method never returns {@code null}.</p> 111 * 112 * @return the {@link 113 * hapi.services.tiller.Tiller.ListReleasesResponseOrBuilder} 114 * implementation representing the release retrieval; never {@code 115 * null} 116 */ 117 public final ListReleasesResponseOrBuilder getListReleasesResponseOrBuilder() { 118 return this.listReleasesResponseOrBuilder; 119 } 120 121 /** 122 * Returns the {@link ListReleasesMojo} responsible for firing this 123 * event. 124 * 125 * <p>This method never returns {@code null}.</p> 126 * 127 * @return the {@link ListReleasesMojo} responsible for firing this 128 * event; never {@code null} 129 */ 130 @Override 131 public final ListReleasesMojo getSource() { 132 return (ListReleasesMojo)super.getSource(); 133 } 134 135}