org.apache.commons.classscan.builtin
Class ClassNameHelper

java.lang.Object
  extended by org.apache.commons.classscan.builtin.ClassNameHelper

public final class ClassNameHelper
extends Object

Classname helper methods


Method Summary
static String getCannonicalClassNameFromPathName(String path)
          Check if supplied path name is a valid pathed file name.
static String getClassNameFromFileName(String fileName)
          Check if supplied file name is a valid class file name.
static String internalToCanonicalName(String internalName)
          Get the canonical name from the internal name
static boolean isValidIdentifier(String identifier)
          Check if supplied name is a valid java package name portion or class identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCannonicalClassNameFromPathName

public static String getCannonicalClassNameFromPathName(String path)
Check if supplied path name is a valid pathed file name. The path must contain valid package names, the file name must be a valid Class name, and must be followed by ".class"

Parameters:
path - A file name with path
Returns:
The class name without the trailing ".class", with the dotted package prefix, or null if the supplied filename is invalid

isValidIdentifier

public static boolean isValidIdentifier(String identifier)
Check if supplied name is a valid java package name portion or class identifier.

Parameters:
identifier - The name of a package file
Returns:
true if the identifier is a valid part of a package or class name

getClassNameFromFileName

public static String getClassNameFromFileName(String fileName)
Check if supplied file name is a valid class file name. The name must be a valid Class name followed by ".class"

Parameters:
fileName - The name of a file (without path)
Returns:
The class name without the trailing ".class", or null if the supplied filename is invalid

internalToCanonicalName

public static String internalToCanonicalName(String internalName)
Get the canonical name from the internal name

Parameters:
internalName - The internal name in the form Ljava/lang/Object;
Returns:
The canonical name in the form java.lang.Object


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.