Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ProfilesRoot |
|
| 2.0;2 |
1 | /* | |
2 | * $Id$ | |
3 | */ | |
4 | ||
5 | package org.apache.maven.profiles; | |
6 | ||
7 | //---------------------------------/ | |
8 | //- Imported classes and packages -/ | |
9 | //---------------------------------/ | |
10 | ||
11 | import java.util.Date; | |
12 | ||
13 | /** | |
14 | * Root element of the profiles.xml file. | |
15 | * | |
16 | * @version $Revision$ $Date$ | |
17 | */ | |
18 | 0 | public class ProfilesRoot implements java.io.Serializable { |
19 | ||
20 | ||
21 | //--------------------------/ | |
22 | //- Class/Member Variables -/ | |
23 | //--------------------------/ | |
24 | ||
25 | /** | |
26 | * Field profiles. | |
27 | */ | |
28 | private java.util.List profiles; | |
29 | ||
30 | /** | |
31 | * Field activeProfiles. | |
32 | */ | |
33 | private java.util.List activeProfiles; | |
34 | ||
35 | ||
36 | //-----------/ | |
37 | //- Methods -/ | |
38 | //-----------/ | |
39 | ||
40 | /** | |
41 | * Method addActiveProfile. | |
42 | * | |
43 | * @param string | |
44 | */ | |
45 | public void addActiveProfile( String string ) | |
46 | { | |
47 | 0 | if ( !(string instanceof String) ) |
48 | { | |
49 | 0 | throw new ClassCastException( "ProfilesRoot.addActiveProfiles(string) parameter must be instanceof " + String.class.getName() ); |
50 | } | |
51 | 0 | getActiveProfiles().add( string ); |
52 | 0 | } //-- void addActiveProfile( String ) |
53 | ||
54 | /** | |
55 | * Method addProfile. | |
56 | * | |
57 | * @param profile | |
58 | */ | |
59 | public void addProfile( Profile profile ) | |
60 | { | |
61 | 0 | if ( !(profile instanceof Profile) ) |
62 | { | |
63 | 0 | throw new ClassCastException( "ProfilesRoot.addProfiles(profile) parameter must be instanceof " + Profile.class.getName() ); |
64 | } | |
65 | 0 | getProfiles().add( profile ); |
66 | 0 | } //-- void addProfile( Profile ) |
67 | ||
68 | /** | |
69 | * Method getActiveProfiles. | |
70 | * | |
71 | * @return java.util.List | |
72 | */ | |
73 | public java.util.List getActiveProfiles() | |
74 | { | |
75 | 0 | if ( this.activeProfiles == null ) |
76 | { | |
77 | 0 | this.activeProfiles = new java.util.ArrayList(); |
78 | } | |
79 | ||
80 | 0 | return this.activeProfiles; |
81 | } //-- java.util.List getActiveProfiles() | |
82 | ||
83 | /** | |
84 | * Method getProfiles. | |
85 | * | |
86 | * @return java.util.List | |
87 | */ | |
88 | public java.util.List getProfiles() | |
89 | { | |
90 | 0 | if ( this.profiles == null ) |
91 | { | |
92 | 0 | this.profiles = new java.util.ArrayList(); |
93 | } | |
94 | ||
95 | 0 | return this.profiles; |
96 | } //-- java.util.List getProfiles() | |
97 | ||
98 | /** | |
99 | * Method removeActiveProfile. | |
100 | * | |
101 | * @param string | |
102 | */ | |
103 | public void removeActiveProfile( String string ) | |
104 | { | |
105 | 0 | if ( !(string instanceof String) ) |
106 | { | |
107 | 0 | throw new ClassCastException( "ProfilesRoot.removeActiveProfiles(string) parameter must be instanceof " + String.class.getName() ); |
108 | } | |
109 | 0 | getActiveProfiles().remove( string ); |
110 | 0 | } //-- void removeActiveProfile( String ) |
111 | ||
112 | /** | |
113 | * Method removeProfile. | |
114 | * | |
115 | * @param profile | |
116 | */ | |
117 | public void removeProfile( Profile profile ) | |
118 | { | |
119 | 0 | if ( !(profile instanceof Profile) ) |
120 | { | |
121 | 0 | throw new ClassCastException( "ProfilesRoot.removeProfiles(profile) parameter must be instanceof " + Profile.class.getName() ); |
122 | } | |
123 | 0 | getProfiles().remove( profile ); |
124 | 0 | } //-- void removeProfile( Profile ) |
125 | ||
126 | /** | |
127 | * Set | |
128 | * List of manually-activated build profiles, | |
129 | * specified in the order in which | |
130 | * they should be applied. | |
131 | * | |
132 | * | |
133 | * @param activeProfiles | |
134 | */ | |
135 | public void setActiveProfiles( java.util.List activeProfiles ) | |
136 | { | |
137 | 0 | this.activeProfiles = activeProfiles; |
138 | 0 | } //-- void setActiveProfiles( java.util.List ) |
139 | ||
140 | /** | |
141 | * Set | |
142 | * Configuration of build profiles for adjusting | |
143 | * the build | |
144 | * according to environmental parameters | |
145 | * . | |
146 | * | |
147 | * @param profiles | |
148 | */ | |
149 | public void setProfiles( java.util.List profiles ) | |
150 | { | |
151 | 0 | this.profiles = profiles; |
152 | 0 | } //-- void setProfiles( java.util.List ) |
153 | ||
154 | ||
155 | 0 | private String modelEncoding = "UTF-8"; |
156 | ||
157 | /** | |
158 | * Set an encoding used for reading/writing the model. | |
159 | * | |
160 | * @param modelEncoding the encoding used when reading/writing the model. | |
161 | */ | |
162 | public void setModelEncoding( String modelEncoding ) | |
163 | { | |
164 | 0 | this.modelEncoding = modelEncoding; |
165 | 0 | } |
166 | ||
167 | /** | |
168 | * @return the current encoding used when reading/writing this model. | |
169 | */ | |
170 | public String getModelEncoding() | |
171 | { | |
172 | 0 | return modelEncoding; |
173 | } | |
174 | } |