    001// Licensed under the Apache License, Version 2.0 (the "License");
    002// you may not use this file except in compliance with the License.
    003// You may obtain a copy of the License at
    004//
    005// http://www.apache.org/licenses/LICENSE-2.0
    006//
    007// Unless required by applicable law or agreed to in writing, software
    008// distributed under the License is distributed on an "AS IS" BASIS,
    009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    010// See the License for the specific language governing permissions and
    011// limitations under the License.
    012package org.apache.tapestry5.versionmigrator;
    013
    014/**
    015 * Represents a Tapestry version that needs a migration due to names that moved from
    016 * one package to another.
    017 */
    018public enum TapestryVersion
    019{
    020
    021    TAPESTRY_5_7_0("5.7.0", "HEAD", "39041bfa2c6c030f2f2e55d1c88c3ed836ff758b" /* 5.6.1 */);
    022
    023    final private String number;
    024    final private String previousVersionGitHash;
    025    final private String versionGitHash;
    026
    027    private TapestryVersion(String number, String versionGitHash, String previousVersionGitHash)
    028    {
    029        this.number = number;
    030        this.versionGitHash = versionGitHash;
    031        this.previousVersionGitHash = previousVersionGitHash;
    032    }
    033
    034    /**
    035     * Returns the version number.
    036     */
    037    public String getNumber()
    038    {
    039        return number;
    040    }
    041
    042    /**
    043     * Returns the Git hash or tag representing the version previous to this one.
    044     */
    045    public String getPreviousVersionGitHash()
    046    {
    047        return previousVersionGitHash;
    048    }
    049
    050    /**
    051     * Represents the Git hash or tag representing this version.
    052     * @return
    053     */
    054    public String getVersionGitHash()
    055    {
    056        return versionGitHash;
    057    }
    058
    059    public String toString()
    060    {
    061        return String.format("Apache Tapestry %s", getNumber());
    062    }
    063
    064}