Java Utililty Methods Class Name Format

List of utility methods to do Class Name Format

Description

The list of methods to do Class Name Format are organized into topic(s).

Method

StringclassToAttributeName(Class clazz)
Helper method to convert a class name into a suitable attribute name.
String ret = clazz.getName();
ret = ret.replaceAll("\\.", "_");
return ret;
StringclassToFile(String name)
Converts a clas name to a file name.
return name.replace('.', '/').concat(".class");
StringclassToFilename(Class clazz)
class To Filename
return classnameToFilename(clazz.getName());
StringclassToFileName(String str)
A method that gets a class based on its file name.
str = str.replace('.', '/');
if (!str.endsWith(".class")) {
    str = str + ".class";
return str;
StringclassToInstance(String uriClass)
Constructs the URI for instance by the URI of class.
int sepidx = uriClass.indexOf('#');
if (sepidx == -1) {
    sepidx = uriClass.lastIndexOf('/');
if (sepidx == -1) {
    sepidx = uriClass.lastIndexOf(':');
if (sepidx == -1) {
...
StringclassToLDAPName(Class c)
convert a full classname like org.site.module.class to an ldap friendly version by replacing all "."
return c.getName().replaceAll("\\.", "-");
StringclassToPath(Class clazz)
translates path to class in package notation to standard path notation with addition of .class suffix
return clazz.getName().replaceAll("\\.", "/") + ".class";
StringclassToPath(String name, boolean resource)
class To Path
boolean i18nClass = false;
String propSuffix = ".properties";
if (name.startsWith("com.pari.client.Helper") || name.startsWith("com.pari.server.Helper")) {
    i18nClass = true;
String classsuffix = ".class";
char oldChar = '.';
char newChar = '/';
...
StringclassToResource(String className)
Converts a class name (with dots) to the corresponding resource we're trying to find in the classpath.
return className.replace('.', '/') + ".class";
StringclassToResourceKeyPrefix(final Class clazz)
class To Resource Key Prefix
return clazz.getName().replace('$', '.');