tigase.jaxmpp.core.client.factory
Class UniversalFactory

java.lang.Object
  extended by tigase.jaxmpp.core.client.factory.UniversalFactory

public class UniversalFactory
extends Object

Provides methods to inject alternative implementation of object in several points in this library.

Author:
bmalkow

Nested Class Summary
static interface UniversalFactory.FactorySpi<T>
          Interface for object factory.
 
Method Summary
static
<T> T
createInstance(String key)
          Creates instance of object with given name.
static void setSpi(String key, UniversalFactory.FactorySpi<?> spi)
          Registers object factory with name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInstance

public static <T> T createInstance(String key)
Creates instance of object with given name.

Parameters:
key - name of object.
Returns:
instance of object or null if no factory is registered for that name.

setSpi

public static void setSpi(String key,
                          UniversalFactory.FactorySpi<?> spi)
Registers object factory with name.

Parameters:
key - name of object factory.
spi - implementation of factory.


Copyright © 2006-2012 Tigase. All Rights Reserved.