de.smartics.properties.resource.util
Class AbstractServiceFactory<T>

Package class diagram package AbstractServiceFactory
java.lang.Object
  extended by de.smartics.properties.resource.util.AbstractServiceFactory<T>
Type Parameters:
T - the type of the service to instantiate.
Direct Known Subclasses:
CacheManagerFactory, ConfigurationPropertiesFactoryFactory, ResourceHeapFactory, ResourceRepositoryFactory

public abstract class AbstractServiceFactory<T>
     
     
extends Object

A factory to create instances of a given type using the Java Service API.


Constructor Summary
protected AbstractServiceFactory(Class<T> type)
          Default constructor.
 
Method Summary
 T create()
          Creates an instance of a service in META-INF/services.
 T create(Class<? extends T> defaultType)
          Creates an instance of a service in META-INF/services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractServiceFactory

protected AbstractServiceFactory(Class<T> type)
Default constructor.

Parameters:
type - the type of instances created by this factory.
Method Detail

create

public final T create()
               throws ResourceException
Creates an instance of a service in META-INF/services.

Returns:
instance of the desired type.
Throws:
ResourceException - if a type cannot be instantiated.

create

public final T create(Class<? extends T> defaultType)
               throws ResourceException
Creates an instance of a service in META-INF/services.

Parameters:
defaultType - the default type to use if there is no configuration file found in META-INF/services.
Returns:
instance of the desired type.
Throws:
ResourceException - if a type cannot be instantiated.


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