Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Lifecycle |
|
| 1.625;1.625 |
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 | 0 | 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 | 0 | if ( !(phase instanceof Phase) ) |
51 | { | |
52 | 0 | throw new ClassCastException( "Lifecycle.addPhases(phase) parameter must be instanceof " + Phase.class.getName() ); |
53 | } | |
54 | 0 | getPhases().add( phase ); |
55 | 0 | } //-- 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 | 0 | 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 | 0 | if ( this.phases == null ) |
76 | { | |
77 | 0 | this.phases = new java.util.ArrayList(); |
78 | } | |
79 | ||
80 | 0 | 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 | 0 | if ( !(phase instanceof Phase) ) |
91 | { | |
92 | 0 | throw new ClassCastException( "Lifecycle.removePhases(phase) parameter must be instanceof " + Phase.class.getName() ); |
93 | } | |
94 | 0 | getPhases().remove( phase ); |
95 | 0 | } //-- 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 | 0 | this.id = id; |
106 | 0 | } //-- 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 | 0 | this.phases = phases; |
116 | 0 | } //-- void setPhases( java.util.List ) |
117 | ||
118 | ||
119 | 0 | 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 | 0 | this.modelEncoding = modelEncoding; |
129 | 0 | } |
130 | ||
131 | /** | |
132 | * @return the current encoding used when reading/writing this model. | |
133 | */ | |
134 | public String getModelEncoding() | |
135 | { | |
136 | 0 | return modelEncoding; |
137 | } | |
138 | } |