net.sf.seaf.factory.impl
Class TypeResolvingFactory

java.lang.Object
  extended by net.sf.seaf.factory.impl.support.DelegatingFactoryBase
      extended by net.sf.seaf.factory.impl.TypeResolvingFactory
All Implemented Interfaces:
Factory

public class TypeResolvingFactory
extends DelegatingFactoryBase
implements Factory

Factory that resolves the requested type before delegating instantiation to an instantiating factory.

When the type resolver returns null, throws SeafTypeResolvingException.


Constructor Summary
TypeResolvingFactory()
          Default empty constructor.
TypeResolvingFactory(TypeResolver<?> typeResolver, Factory instantiatingFactory)
          Full constructor.
 
Method Summary
<Type> Type
getInstanceOf(Class<Type> type)
          Return an initialized instance of the specified type.
 void setTypeResolver(TypeResolver<?> typeResolver)
          Set the type resolver.
 
Methods inherited from class net.sf.seaf.factory.impl.support.DelegatingFactoryBase
getInstantiatingFactory, setInstantiatingFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeResolvingFactory

public TypeResolvingFactory()
Default empty constructor. The type resolver and instantiating factory must be supplied via its setter methods.


TypeResolvingFactory

public TypeResolvingFactory(TypeResolver<?> typeResolver,
                            Factory instantiatingFactory)
Full constructor.

Parameters:
typeResolver - The type resolver
instantiatingFactory - The instantiating factory
Method Detail

getInstanceOf

public <Type> Type getInstanceOf(Class<Type> type)
                   throws SeafTypeResolvingException
Description copied from interface: Factory
Return an initialized instance of the specified type.

Specified by:
getInstanceOf in interface Factory
Parameters:
type - The type of the requested instance
Returns:
The instance
Throws:
SeafTypeResolvingException

setTypeResolver

public final void setTypeResolver(TypeResolver<?> typeResolver)
Set the type resolver.

Parameters:
typeResolver - The type resolver


Copyright © 2008-2011 SEAF. All Rights Reserved.