org.apache.hivemind.util
Class ClasspathResource

java.lang.Object
  extended by org.apache.hivemind.util.AbstractResource
      extended by org.apache.hivemind.util.ClasspathResource
All Implemented Interfaces:
Resource

public class ClasspathResource
extends AbstractResource

Implementation of Resource for resources found within the classpath.

Author:
Howard Lewis Ship

Constructor Summary
ClasspathResource(ClassResolver resolver, java.lang.String path)
           
ClasspathResource(ClassResolver resolver, java.lang.String path, java.util.Locale locale)
           
 
Method Summary
 Resource getLocalization(java.util.Locale locale)
          Locates the localization of the resource using LocalizedResourceFinder.
 java.net.URL getResourceURL()
          Invokes ClassResolver.getResource(String) with the path.
 int hashCode()
           
protected  Resource newResource(java.lang.String path)
           
 java.lang.String toString()
           
 
Methods inherited from class org.apache.hivemind.util.AbstractResource
equals, getLocale, getName, getPath, getRelativeResource
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClasspathResource

public ClasspathResource(ClassResolver resolver,
                         java.lang.String path)

ClasspathResource

public ClasspathResource(ClassResolver resolver,
                         java.lang.String path,
                         java.util.Locale locale)
Method Detail

getLocalization

public Resource getLocalization(java.util.Locale locale)
Locates the localization of the resource using LocalizedResourceFinder.

Parameters:
locale - to localize for, or null for no localization.
Returns:
a localized version of this resource, of null if the resource itself does not exist.

getResourceURL

public java.net.URL getResourceURL()
Invokes ClassResolver.getResource(String) with the path.

Returns:
the URL for the resource if it exists, or null if it does not

toString

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

newResource

protected Resource newResource(java.lang.String path)
Specified by:
newResource in class AbstractResource