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.util.regex.Matcher;
020
021import org.apache.maven.plugins.annotations.Parameter;
022
023import org.microbean.helm.ReleaseManager;
024
025/**
026 * An {@link AbstractSingleReleaseMojo} whose implementations operate
027 * on a particular versioned release.
028 *
029 * @author <a href="https://about.me/lairdnelson"
030 * target="_parent">Laird Nelson</a>
031 */
032public abstract class AbstractSingleVersionedReleaseMojo extends AbstractSingleReleaseMojo {
033
034
035  /*
036   * Instance fields.
037   */
038
039
040  /**
041   * The version of the release.
042   */
043  @Parameter(required = true, defaultValue = "0")
044  private Integer version;
045
046
047  /*
048   * Constructors.
049   */
050
051
052  /**
053   * Creates a new {@link AbstractSingleVersionedReleaseMojo}.
054   */
055  protected AbstractSingleVersionedReleaseMojo() {
056    super();
057  }
058
059
060  /*
061   * Instance methods.
062   */
063
064
065  /**
066   * Returns the version of the release to operate on.
067   *
068   * <p>This method may return {@code null}.</p>
069   *
070   * <p>Overrides of this method are permitted to return {@code
071   * null}.</p>
072   *
073   * @return the version of the release to operate on, or {@code null}
074   *
075   * @see #setVersion(Integer)
076   */
077  public Integer getVersion() {
078    return this.version;
079  }
080
081  /**
082   * Sets the version of the release to operate on.
083   *
084   * @param version the release version; must not be {@code null}
085   *
086   * @exception NullPointerException if {@code version} is {@code
087   * null}
088   *
089   * @see #getVersion()
090   */
091  public void setVersion(final Integer version) {
092    this.version = version;
093  }
094  
095}