com.dyuproject.ioc
Class ResolverCollection

java.lang.Object
  extended by com.dyuproject.ioc.ResolverCollection
All Implemented Interfaces:
Resource.Resolver
Direct Known Subclasses:
DefaultResolver

public class ResolverCollection
extends Object
implements Resource.Resolver

A composite resolver which wraps an map of resolvers.

Author:
David Yu
Date created:
Feb 23, 2009

Field Summary
protected  Map<String,Resource.Resolver> _resolvers
           
protected  String _type
           
static String TYPE
          The type of this resolver.
 
Constructor Summary
ResolverCollection()
           
ResolverCollection(int size)
           
ResolverCollection(int size, String type)
           
ResolverCollection(Map<String,Resource.Resolver> resolvers, String type)
           
 
Method Summary
 Resource createResource(String path)
          Creates a resource from a given path string.
 Resource.Resolver getResolver(String type)
          Gets a resolver based from the given type.
 String getType()
          Gets the type (id) of resolver
 Resource.Resolver putResolver(Resource.Resolver resolver)
          Puts a resolver and using its type as the key.
 void resolve(Resource resource, Context context)
          Resolves a resource by setting the Reader property of the Resource.
protected  void resolveDefault(Resource resource, Context context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final String TYPE
The type of this resolver. ("collection")

See Also:
Constant Field Values

_type

protected final String _type

_resolvers

protected final Map<String,Resource.Resolver> _resolvers
Constructor Detail

ResolverCollection

public ResolverCollection()

ResolverCollection

public ResolverCollection(int size)

ResolverCollection

public ResolverCollection(int size,
                          String type)

ResolverCollection

public ResolverCollection(Map<String,Resource.Resolver> resolvers,
                          String type)
Method Detail

getType

public final String getType()
Description copied from interface: Resource.Resolver
Gets the type (id) of resolver

Specified by:
getType in interface Resource.Resolver

getResolver

public final Resource.Resolver getResolver(String type)
Gets a resolver based from the given type.


putResolver

public final Resource.Resolver putResolver(Resource.Resolver resolver)
Puts a resolver and using its type as the key.


resolve

public final void resolve(Resource resource,
                          Context context)
                   throws IOException
Description copied from interface: Resource.Resolver
Resolves a resource by setting the Reader property of the Resource. That is done via Resource.resolve(Reader).

Specified by:
resolve in interface Resource.Resolver
Throws:
IOException

resolveDefault

protected void resolveDefault(Resource resource,
                              Context context)
                       throws IOException
Throws:
IOException

createResource

public Resource createResource(String path)
                        throws IOException
Description copied from interface: Resource.Resolver
Creates a resource from a given path string.

Specified by:
createResource in interface Resource.Resolver
Throws:
IOException


Copyright © 2008-2013. All Rights Reserved.