001package org.apache.maven.lifecycle;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.List;
023import java.util.Map;
024
025import org.apache.maven.lifecycle.mapping.LifecyclePhase;
026
027/**
028 * Class Lifecycle.
029 */
030public class Lifecycle
031{
032    public Lifecycle()
033    {
034    }
035
036    public Lifecycle( String id, List<String> phases, Map<String, LifecyclePhase> defaultPhases )
037    {
038        this.id = id;
039        this.phases = phases;
040        this.defaultPhases = defaultPhases;
041    }
042
043    // <lifecycle>
044    //   <id>clean</id>
045    //   <phases>
046    //     <phase>pre-clean</phase>
047    //     <phase>clean</phase>
048    //     <phase>post-clean</phase>
049    //   </phases>
050    //   <default-phases>
051    //     <clean>org.apache.maven.plugins:maven-clean-plugin:clean</clean>
052    //   </default-phases>
053    // </lifecycle>
054
055    private String id;
056
057    private List<String> phases;
058
059    private Map<String, LifecyclePhase> defaultPhases;
060
061    public String getId()
062    {
063        return this.id;
064    }
065
066    public List<String> getPhases()
067    {
068        return this.phases;
069    }
070
071    public Map<String, LifecyclePhase> getDefaultLifecyclePhases()
072    {
073        return defaultPhases;
074    }
075    
076    @Deprecated
077    public Map<String, String> getDefaultPhases()
078    {
079        return LifecyclePhase.toLegacyMap( getDefaultLifecyclePhases() );
080    }
081
082    @Override
083    public String toString()
084    {
085        return id + " -> " + phases;
086    }
087
088}