net.sf.freecol.common.resources
Class ResourceFactory
java.lang.Object
net.sf.freecol.common.resources.ResourceFactory
public class ResourceFactory
- extends java.lang.Object
A factory class for creating Resource instances.
- See Also:
Resource
|
Field Summary |
private static java.util.logging.Logger |
logger
|
private static java.util.Map<java.net.URI,java.lang.ref.WeakReference<Resource>> |
resources
A WeakHashMap to ensure that only one
Resource is created given the same
URI. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
private static final java.util.logging.Logger logger
resources
private static java.util.Map<java.net.URI,java.lang.ref.WeakReference<Resource>> resources
- A
WeakHashMap to ensure that only one
Resource is created given the same
URI.
ResourceFactory
public ResourceFactory()
getResource
private static Resource getResource(java.net.URI uri)
- Gets the resource with the given
URI from
resources.
- Parameters:
uri - The URI to identify a previously created
Resource.
- Returns:
- The
Resource identified by the given
URI, or null if no such
Resource exists.
createResource
public static Resource createResource(java.net.URI uri)
- Returns an instance of
Resource with the
given URI as the parameter.
- Parameters:
uri - The URI used when creating the
instance.
- Returns:
- A previously created instance of
Resource
with the given URI if such an object has
already been created, or a new instance if not.