KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > cvslib > CvsUser


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */

18 package org.apache.tools.ant.taskdefs.cvslib;
19
20 import org.apache.tools.ant.BuildException;
21
22 /**
23  * Represents a CVS user with a userID and a full name.
24  *
25  */

26 public class CvsUser {
27     /** The user's Id */
28     private String JavaDoc userID;
29     /** The user's full name */
30     private String JavaDoc displayName;
31
32
33     /**
34      * Set the user's fullname
35      *
36      * @param displayName the user's full name
37      */

38     public void setDisplayname(final String JavaDoc displayName) {
39         this.displayName = displayName;
40     }
41
42
43     /**
44      * Set the user's id
45      *
46      * @param userID the user's new id value.
47      */

48     public void setUserid(final String JavaDoc userID) {
49         this.userID = userID;
50     }
51
52
53     /**
54      * Get the user's id.
55      *
56      * @return The userID value
57      */

58     public String JavaDoc getUserID() {
59         return userID;
60     }
61
62
63     /**
64      * Get the user's full name
65      *
66      * @return the user's full name
67      */

68     public String JavaDoc getDisplayname() {
69         return displayName;
70     }
71
72
73     /**
74      * Validate that this object is configured.
75      *
76      * @exception BuildException if the instance has not be correctly
77      * configured.
78      */

79     public void validate() throws BuildException {
80         if (null == userID) {
81             final String JavaDoc message = "Username attribute must be set.";
82
83             throw new BuildException(message);
84         }
85         if (null == displayName) {
86             final String JavaDoc message =
87                 "Displayname attribute must be set for userID " + userID;
88
89             throw new BuildException(message);
90         }
91     }
92 }
93
94
Popular Tags