de.smartics.properties.api.config.app
Class ConfigurationPropertiesFactoryFactory

Package class diagram package ConfigurationPropertiesFactoryFactory
java.lang.Object
  extended by de.smartics.properties.resource.util.AbstractServiceFactory<ConfigurationPropertiesFactory>
      extended by de.smartics.properties.api.config.app.ConfigurationPropertiesFactoryFactory

public final class ConfigurationPropertiesFactoryFactory
     
     
extends AbstractServiceFactory< ConfigurationPropertiesFactory>

Creates instances of the ConfigurationPropertiesFactory.

Instances of ConfigurationPropertiesFactory create selected implementations of the ConfigurationProperties interface. This static factory of factories allows to create the factories.

Factories can be created in two ways:

  1. Use createDefaultFactory() if the name of the factory is supplied by META-INF/services
  2. Use createFactory(Class) or createFactory(String) if the name is determined by the client code at runtime.

Note:

Usually the second way (especially if a class is supplied) is not really necessary since the constructor can be called by the client code with the same effect. But using this factory of factories may be more convenient.


Field Summary
static ConfigurationPropertiesFactoryFactory INSTANCE
          The singleton.
 
Method Summary
static ConfigurationPropertiesFactory createDefaultFactory()
          Creates the default factory found on the class path.
static
<T extends ConfigurationPropertiesFactory>
T
createFactory(Class<T> factoryType)
          Creates a factory of the given type.
static ConfigurationPropertiesFactory createFactory(String factoryTypeName)
          Creates a factory for the given type name.
 
Methods inherited from class de.smartics.properties.resource.util.AbstractServiceFactory
create, create
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ConfigurationPropertiesFactoryFactory INSTANCE
The singleton.

Method Detail

createDefaultFactory

public static ConfigurationPropertiesFactory createDefaultFactory()
                                                           throws ConfigurationFactoryException
Creates the default factory found on the class path. The factory class is registered in META-INF/services/de.smartics.properties.api.config.app.ConfigurationPropertiesFactory .

Issues a warning if more than one implementation is found. Returns an instance of the first implementation found.

Returns:
the instance of the default factory. Never null.
Throws:
ConfigurationFactoryException - if no factory can be created.

createFactory

public static <T extends ConfigurationPropertiesFactory> T createFactory(Class<T> factoryType)
                                                              throws NullPointerException,
                                                                     ConfigurationFactoryException
Creates a factory of the given type.

Type Parameters:
T - the type of the factory.
Parameters:
factoryType - the type of the factory to create.
Returns:
the created instance. Never null.
Throws:
NullPointerException - if factoryType is null.
ConfigurationFactoryException - on any problem creating the requested factory instance.

createFactory

public static ConfigurationPropertiesFactory createFactory(String factoryTypeName)
                                                    throws NullPointerException,
                                                           ConfigurationFactoryException
Creates a factory for the given type name.

Parameters:
factoryTypeName - the fully qualified name of a type that implements ConfigurationProperties .
Returns:
the created instance. Never null.
Throws:
NullPointerException - if factoryTypeName is null.
ConfigurationFactoryException - on any problem creating the requested factory instance.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.