You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ClassPath.java 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Javassist, a Java-bytecode translator toolkit.
  3. * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. Alternatively, the contents of this file may be used under
  8. * the terms of the GNU Lesser General Public License Version 2.1 or later,
  9. * or the Apache License Version 2.0.
  10. *
  11. * Software distributed under the License is distributed on an "AS IS" basis,
  12. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. * for the specific language governing rights and limitations under the
  14. * License.
  15. */
  16. package javassist;
  17. import java.io.InputStream;
  18. import java.net.URL;
  19. /**
  20. * <code>ClassPath</code> is an interface implemented by objects
  21. * representing a class search path.
  22. * <code>ClassPool</code> uses those objects for reading class files.
  23. *
  24. * <p>The users can define a class implementing this interface so that
  25. * a class file is obtained from a non-standard source.
  26. *
  27. * @see ClassPool#insertClassPath(ClassPath)
  28. * @see ClassPool#appendClassPath(ClassPath)
  29. * @see ClassPool#removeClassPath(ClassPath)
  30. */
  31. public interface ClassPath {
  32. /**
  33. * Opens a class file.
  34. * This method may be called just to examine whether the class file
  35. * exists as well as to read the contents of the file.
  36. *
  37. * <p>This method can return null if the specified class file is not
  38. * found. If null is returned, the next search path is examined.
  39. * However, if an error happens, this method must throw an exception
  40. * so that the search will be terminated.
  41. *
  42. * <p>This method should not modify the contents of the class file.
  43. *
  44. * @param classname a fully-qualified class name
  45. * @return the input stream for reading a class file
  46. * @see javassist.Translator
  47. */
  48. InputStream openClassfile(String classname) throws NotFoundException;
  49. /**
  50. * Returns the uniform resource locator (URL) of the class file
  51. * with the specified name.
  52. *
  53. * @param classname a fully-qualified class name.
  54. * @return null if the specified class file could not be found.
  55. */
  56. URL find(String classname);
  57. }