org.ckkloverdos.resource
Class ClassLoaderResourceContext

java.lang.Object
  extended by org.ckkloverdos.resource.ResourseContextSkeleton
      extended by org.ckkloverdos.resource.ClassLoaderResourceContext
All Implemented Interfaces:
IResourceContext, IToStringAware

public class ClassLoaderResourceContext
extends ResourseContextSkeleton
implements IToStringAware

Classloader-based resource context.

Author:
Christos KK Loverdos

Constructor Summary
ClassLoaderResourceContext(java.lang.ClassLoader loader)
          Constructs a new context that will use the provided class loader to resolve resources.
ClassLoaderResourceContext(java.lang.ClassLoader loader, IResourceContext parent)
          Constructs a new context that will first use the provided class loader to resolve resources and the parent context on failure.
 
Method Summary
 java.lang.ClassLoader getClassLoader()
          Returns the class loader used to resolve resources.
 IResource getLocalResource(java.lang.String name)
          Returns the resource with the given name, using only the underlying class loader to resolve it (the parent context is not consulted).
 java.lang.String toString()
           
 void toStringAware(ToString ts)
           
 
Methods inherited from class org.ckkloverdos.resource.ResourseContextSkeleton
getParent, getResource, normalize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassLoaderResourceContext

public ClassLoaderResourceContext(java.lang.ClassLoader loader)
Constructs a new context that will use the provided class loader to resolve resources.

Parameters:
loader -

ClassLoaderResourceContext

public ClassLoaderResourceContext(java.lang.ClassLoader loader,
                                  IResourceContext parent)
Constructs a new context that will first use the provided class loader to resolve resources and the parent context on failure.

Parameters:
loader -
parent -
Method Detail

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the class loader used to resolve resources.


getLocalResource

public IResource getLocalResource(java.lang.String name)
Returns the resource with the given name, using only the underlying class loader to resolve it (the parent context is not consulted).

Specified by:
getLocalResource in interface IResourceContext
Parameters:
name -
Returns:
the resource if found or EmptyResource.INSTANCE otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringAware

public void toStringAware(ToString ts)
Specified by:
toStringAware in interface IToStringAware


Copyright © 1999-2007 Christos KK Loverdos. All Rights Reserved.