1. /*
  2. * Copyright 2000-2002,2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.ant.taskdefs.optional.depend;
  18. /**
  19. * Utility class file routines. This class provides a number of static
  20. * utility methods to convert between the formats used in the Java class
  21. * file format and those commonly used in Java programming.
  22. *
  23. *
  24. */
  25. public class ClassFileUtils {
  26. /**
  27. * Convert a class name from class file slash notation to java source
  28. * file dot notation.
  29. *
  30. * @param name the class name in slash notation org/apache/ant
  31. * @return the class name in dot notation (eg. java.lang.Object).
  32. */
  33. public static String convertSlashName(String name) {
  34. return name.replace('\\', '.').replace('/', '.');
  35. }
  36. /**
  37. * Convert a class name from java source file dot notation to class file
  38. * slash notation..
  39. *
  40. * @param dotName the class name in dot notation (eg. java.lang.Object).
  41. * @return the class name in slash notation (eg. java/lang/Object).
  42. */
  43. public static String convertDotName(String dotName) {
  44. return dotName.replace('.', '/');
  45. }
  46. }