org.peaseplate.locator
Class AbstractURLBasedLocator

java.lang.Object
  extended by org.peaseplate.locator.AbstractLocator
      extended by org.peaseplate.locator.AbstractURLBasedLocator
All Implemented Interfaces:
java.io.Serializable, Locator
Direct Known Subclasses:
AbstractClassLoaderLocator, URLBasedMessagesLocator, URLBasedTemplateLocator

public abstract class AbstractURLBasedLocator
extends AbstractLocator

An abstract implementation of a locator that is based on an URL

See Also:
Serialized Form

Constructor Summary
AbstractURLBasedLocator(java.net.URL url, ResourceKey key)
          Creates the URL based locator
AbstractURLBasedLocator(java.net.URL url, java.lang.String name, java.util.Locale locale, java.lang.String encoding)
          Creates the URL based locator
 
Method Summary
 java.net.URL getUrl()
          Returns the URL this locator is based on
 boolean isOutdated()
          Returns true if the resource described by the locator got updated and needs to be reloaded
 java.lang.String toString()
          A meaningful representation of the locator, mainly used for textual output e.g. in error messages
protected  void updateMetadata()
          Updates the timestamp and the raw size in the metadata
 
Methods inherited from class org.peaseplate.locator.AbstractLocator
getKey, getRawSize, getTimestamp, setRawSize, setTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractURLBasedLocator

public AbstractURLBasedLocator(java.net.URL url,
                               java.lang.String name,
                               java.util.Locale locale,
                               java.lang.String encoding)
                        throws java.lang.IllegalArgumentException
Creates the URL based locator

Parameters:
url - the URL
name - the name
locale - the locale
encoding - the encoding
Throws:
java.lang.IllegalArgumentException - if the URL or the name is null

AbstractURLBasedLocator

public AbstractURLBasedLocator(java.net.URL url,
                               ResourceKey key)
                        throws java.lang.IllegalArgumentException
Creates the URL based locator

Parameters:
url - the URL
key - the key
Throws:
java.lang.IllegalArgumentException - if the URL or the key is null
Method Detail

getUrl

public java.net.URL getUrl()
Returns the URL this locator is based on

Returns:
the URL this locator is based on

isOutdated

public boolean isOutdated()
Description copied from interface: Locator
Returns true if the resource described by the locator got updated and needs to be reloaded

Returns:
true if the resource should get reloaded
See Also:
Locator.isOutdated()

updateMetadata

protected void updateMetadata()
Updates the timestamp and the raw size in the metadata


toString

public java.lang.String toString()
Description copied from interface: Locator
A meaningful representation of the locator, mainly used for textual output e.g. in error messages

Specified by:
toString in interface Locator
Overrides:
toString in class java.lang.Object
Returns:
a meaningful representation of the locator
See Also:
Object.toString()


Copyright © 2008. All Rights Reserved.