KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > connector > FacadeUtil


1 /**
2  * Copyright 2005, 2006 ToolCafe, Inc. All rights reserved.
3  */

4 package org.columba.mail.connector;
5
6 import org.columba.addressbook.facade.IContactItem;
7 import org.columba.core.util.NameParser;
8 import org.columba.core.util.NameParser.Name;
9
10 /**
11  * Utilities to assist with using the addressbook facade
12  * @author Rick Horowitz
13  *
14  */

15 public class FacadeUtil {
16     
17     private static FacadeUtil _instance;
18     public static FacadeUtil getInstance() {
19         if (_instance == null)
20             _instance = new FacadeUtil();
21         return _instance;
22     }
23     
24     private FacadeUtil() {
25     }
26
27     /**
28      * Initialize the IContactItem with the specified name and emailAddr
29      * @param contactItem The IContactItem to initialize
30      * @param displayName The displayName to
31      * @param emailAddr
32      */

33     public void initContactItem(IContactItem contactItem, String JavaDoc displayName, String JavaDoc emailAddr) {
34         
35         NameParser.Name name = NameParser.getInstance().parseDisplayName(displayName);
36         contactItem.setEmailAddress(emailAddr);
37         contactItem.setFirstName(name.getFirstName());
38         contactItem.setLastName(name.getLastName());
39         contactItem.setName(name.toString());
40     }
41 }
42
Popular Tags