Coverage details for base.user.jcard.Name

LineHitsSource
1 /*******************************************************************************
2  * InternetCafe is a software solution that helps the management of Cybercafes
3  * according with the ITALIAN DECREE LAW ON ANTI-TERROR MEASURES, 27 JULY 2005.
4  * Copyright (C) 2006 Guido Angelo Ingenito
5  
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *******************************************************************************/
20  
21 package base.user.jcard;
22  
2324public class Name extends Property {
24     
25     private static final String FIELD_NAME_DELIMITER=";";
26     
2712    private String familyName = ""; // init all to empty string, so as to not print null.
2812    private String givenName = "";
2912    private String additionalName = "";
3012    private String prefix = "";
3112    private String suffix = "";
32     
33     // Setters
34     
35     /**
36      * @param additionalName The additionalName to set.
37      */
38     public void setAdditionalName(String additionalName) {
393        this.additionalName = additionalName;
403    }
41  
42     /**
43      * @param familyName The familyName to set.
44      */
45     public void setFamilyName(String familyName) {
463        this.familyName = familyName;
473    }
48  
49     /**
50      * @param givenName The givenName to set.
51      */
52     public void setGivenName(String givenName) {
536        this.givenName = givenName;
546    }
55  
56     /**
57      * @param prefix The prefix to set.
58      */
59     public void setPrefix(String prefix) {
603        this.prefix = prefix;
613    }
62  
63     /**
64      * @param suffix The suffix to set.
65      */
66     public void setSuffix(String suffix) {
673        this.suffix = suffix;
683    }
69     
70     // Inherited abstract methods
71     
72     public void setPropertyName() {
7312        super.PROPERTY_NAME = "N:";
7412    }
75     
76     public void doValidate() throws JCardException {
77         // At least first name must be given.
786        if(givenName == null || givenName == "") {
793            throw new JCardException("Validation error: At least given name must be populated");
80         }
813    }
82  
83     // It is NOT responsibility of each toJCardString method to append a CRLF at the end of its write.
84     public String toString() {
856        StringBuffer name = new StringBuffer(30);
866        name.append(familyName);
876        name.append(FIELD_NAME_DELIMITER);
886        name.append(givenName);
896        name.append(FIELD_NAME_DELIMITER);
906        name.append(additionalName);
916        name.append(FIELD_NAME_DELIMITER);
926        name.append(prefix);
936        name.append(FIELD_NAME_DELIMITER);
946        name.append(suffix);
956        return name.toString();
96     }
97 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.