Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What about the API for Class?



I'm working on a custom ClassLoader. I'm attempting to implement the method ClassLoader.findResource() so that I can look in a special location for the named resource.

I'm trying to access this functionality thru the Class.getResource() method, which is supposed to delegate the call to ClassLoader.findResource(). I think there might be something wrong with the API description for Class.getResource(), which reads

*****
Finds a resource with a given name. This method returns null if no resource with this name is found. The rules for searching resources associated with a given class are implemented by the * defining class loader of the class.
This method delegates the call to its class loader, after making these changes to the resource name: if the resource name starts with "/", it is unchanged; otherwise, the package name is prepended to the resource name after converting "." to "/". If this object was loaded by the bootstrap loader, the call is delegated to ClassLoader.getSystemResource.
*****


That whole part about modifying the name of the resource doesn't seem to happen. The resulting call to ClassLoader.findResource() gives the same name as passed to Class.getResource(). I also looked at the code for those methods, and indeed they don't do any modifications on the name at all.

So I guess my question is whether I'm making some mistake in my understanding of that API. If not, why would that be in the documentation?


Now I need to figure out how to get a resource depending on what class requests it...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden


This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.