简体   繁体   中英

How can I write a ClassLoader that does this?

I'm trying to make a URLClassLoader which behaves as follows:

  • If asked for a class whose name is in a given set of inclusions, load it as normal
  • Otherwise, return a dummy class of my choice

How should I go about this? My attempt at doing this didn't work - see my earlier question for details.

如果在包含列表中,则在方法loadClass中扩展URLClassLoader返回super.loadClass(originalName),否则返回super.load(myDummyClass)。

Basically, you cannot do this. See my answer to your earlier question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM