Logo Search packages:      
Sourcecode: libloader version File versions  Download package

ResourceKey org::jfree::resourceloader::loader::URLResourceLoader::createKey ( Object  value,
Map  factoryKeys 
) throws ResourceKeyCreationException [inline]

Creates a new resource key from the given object and the factory keys.

Parameters:
value 
factoryKeys 
Returns:
the created key.
Exceptions:
org.jfree.resourceloader.ResourceKeyCreationException if creating the key failed.

Implements org::jfree::resourceloader::ResourceLoader.

Definition at line 93 of file URLResourceLoader.java.

  {
    if (value instanceof URL)
    {
      return new ResourceKey
          (URLResourceLoader.class.getName(), value, factoryKeys);
    }
    if (value instanceof String)
    {
      String valueString = (String) value;
      // the 'file' schema is defined to have double-slashes, but the JDK
      // ignores RFC 1738 in that case. So we have to check for these beasts
      // directly ..
      if (valueString.indexOf("://") >= 0 ||
          valueString.startsWith("file:/"))
      {
        try
        {
          return new ResourceKey(URLResourceLoader.class.getName(),
              new URL(valueString), factoryKeys);

        }
        catch (MalformedURLException mfue)
        {
          // we dont take this easy!
          throw new ResourceKeyCreationException("Malformed value: " + value);
        }
      }
    }

    return null;
  }


Generated by  Doxygen 1.6.0   Back to index