Back to project page foxail_reader.
The source code is released under:
GNU General Public License
If you think the Android project foxail_reader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.foxail.android.reader.client; //ww w. j a va2s. c o m import java.util.HashMap; import java.util.Map; public class ClientFactory { private Map<String, String> clientMap = new HashMap<String, String>(); private static ClientFactory instance; private Map<String, Client> clients = new HashMap<String, Client>(); public Map<String, String> getClientMap() { return clientMap; } public static ClientFactory getInstance() { if (instance == null) { instance = new ClientFactory(); instance.clientMap.put("cnbeta", "org.foxail.android.reader.client.CnBetaClient"); } return instance; } public Client getClient(String clientName) { if (!clientMap.containsKey(clientName)) { return null; } Client client = clients.get(clientName); if (client == null) { String className = clientMap.get(clientName); try{ client = (Client) Class.forName(className).newInstance(); }catch(Exception e){ } clients.put(clientName, client); } return client; } }