1 /*
2 * $Id$
3 */
4
5 package org.apache.maven.plugin.lifecycle;
6
7 //---------------------------------/
8 //- Imported classes and packages -/
9 //---------------------------------/
10
11 import java.util.Date;
12
13 /**
14 *
15 * A custom lifecycle mapping definition.
16 *
17 *
18 * @version $Revision$ $Date$
19 */
20 public class Lifecycle implements java.io.Serializable {
21
22
23 //--------------------------/
24 //- Class/Member Variables -/
25 //--------------------------/
26
27 /**
28 * The ID of this lifecycle, for identification in the mojo
29 * descriptor.
30 */
31 private String id;
32
33 /**
34 * Field phases.
35 */
36 private java.util.List phases;
37
38
39 //-----------/
40 //- Methods -/
41 //-----------/
42
43 /**
44 * Method addPhase.
45 *
46 * @param phase
47 */
48 public void addPhase( Phase phase )
49 {
50 if ( !(phase instanceof Phase) )
51 {
52 throw new ClassCastException( "Lifecycle.addPhases(phase) parameter must be instanceof " + Phase.class.getName() );
53 }
54 getPhases().add( phase );
55 } //-- void addPhase( Phase )
56
57 /**
58 * Get the ID of this lifecycle, for identification in the mojo
59 * descriptor.
60 *
61 * @return String
62 */
63 public String getId()
64 {
65 return this.id;
66 } //-- String getId()
67
68 /**
69 * Method getPhases.
70 *
71 * @return java.util.List
72 */
73 public java.util.List getPhases()
74 {
75 if ( this.phases == null )
76 {
77 this.phases = new java.util.ArrayList();
78 }
79
80 return this.phases;
81 } //-- java.util.List getPhases()
82
83 /**
84 * Method removePhase.
85 *
86 * @param phase
87 */
88 public void removePhase( Phase phase )
89 {
90 if ( !(phase instanceof Phase) )
91 {
92 throw new ClassCastException( "Lifecycle.removePhases(phase) parameter must be instanceof " + Phase.class.getName() );
93 }
94 getPhases().remove( phase );
95 } //-- void removePhase( Phase )
96
97 /**
98 * Set the ID of this lifecycle, for identification in the mojo
99 * descriptor.
100 *
101 * @param id
102 */
103 public void setId( String id )
104 {
105 this.id = id;
106 } //-- void setId( String )
107
108 /**
109 * Set the phase mappings for this lifecycle.
110 *
111 * @param phases
112 */
113 public void setPhases( java.util.List phases )
114 {
115 this.phases = phases;
116 } //-- void setPhases( java.util.List )
117
118
119 private String modelEncoding = "UTF-8";
120
121 /**
122 * Set an encoding used for reading/writing the model.
123 *
124 * @param modelEncoding the encoding used when reading/writing the model.
125 */
126 public void setModelEncoding( String modelEncoding )
127 {
128 this.modelEncoding = modelEncoding;
129 }
130
131 /**
132 * @return the current encoding used when reading/writing this model.
133 */
134 public String getModelEncoding()
135 {
136 return modelEncoding;
137 }
138 }