1
2
3
4
5
6
7
8 package org.apache.maven.settings;
9
10
11
12
13
14
15
16
17
18
19 public class TrackableBase
20 implements java.io.Serializable
21 {
22
23
24 public static final String USER_LEVEL = "user-level";
25 public static final String GLOBAL_LEVEL = "global-level";
26
27 private String sourceLevel = USER_LEVEL;
28 private boolean sourceLevelSet = false;
29
30 public void setSourceLevel( String sourceLevel )
31 {
32 if ( sourceLevelSet )
33 {
34 throw new IllegalStateException( "Cannot reset sourceLevel attribute; it is already set to: " + sourceLevel );
35 }
36 else if ( !( USER_LEVEL.equals( sourceLevel ) || GLOBAL_LEVEL.equals( sourceLevel ) ) )
37 {
38 throw new IllegalArgumentException( "sourceLevel must be one of: {" + USER_LEVEL + "," + GLOBAL_LEVEL + "}" );
39 }
40 else
41 {
42 this.sourceLevel = sourceLevel;
43 this.sourceLevelSet = true;
44 }
45 }
46
47 public String getSourceLevel()
48 {
49 return sourceLevel;
50 }
51
52
53 }