Java Utililty Methods Class Load

List of utility methods to do Class Load

Description

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

Method

StringgetClassDescriptor(Class type)
Get the JNI class descriptor corresponding to the provided type parameter.
final String name = type.getName().replace('.', '/');
if (CLASS_DESCRIPTORS.containsKey(name)) {
    return CLASS_DESCRIPTORS.get(name);
if (type.isArray()) {
    return name;
return "L" + name + ';';
...
String[]getClasses(Class infoClass)
Get classes for a class.
String result[] = null;
Object[] classes = null;
classes = infoClass.getDeclaredClasses();
if ((classes == null) || (classes.length == 0))
    return result;
Comparator comparator = new Comparator() {
    public int compare(Object o1, Object o2) {
        return o1.toString().compareTo(o2.toString());
...
ListgetClasses(Class t)
get Classes
List<Class> list = new ArrayList<Class>();
list.add(t);
Class clazz = t.getSuperclass();
while (!clazz.equals(Object.class)) {
    list.add(clazz);
    clazz = clazz.getSuperclass();
return list;
...
Class[]getClasses(Object... objects)
get Classes
List<Class<?>> asClasses = new ArrayList<Class<?>>();
for (Object ob : objects) {
    if (ob == null) {
        continue;
    asClasses.add(ob.getClass());
return asClasses.toArray(new Class[asClasses.size()]);
...
ListgetClasses(String input)
get Classes
if (!input.contains("."))
    return Collections.emptyList(); 
ArrayList<String> classes = new ArrayList<>();
while (input.contains(".")) {
    input = input.substring(input.indexOf('.') + 1); 
    classes.add("." + input.substring(0, endOfType(input)));
return Collections.unmodifiableList(classes);
...
Class[]getClassesFromPaths(String[] classpaths)
Retrieves the Class object representations of the given String array
List<Class<?>> classes = new ArrayList<Class<?>>();
for (String classPath : classpaths) {
    try {
        classes.add(Class.forName(classPath));
    } catch (ClassNotFoundException e) {
return classes.toArray(new Class<?>[classes.size()]);
...
ListgetClassesOfType(T[] l, Class type)
Get the all classes of type U in the collection
List<U> list = new ArrayList<U>();
for (T o : l) {
    if (type.isInstance(o)) {
        list.add(type.cast(o));
return list;
List>getClassesTree(Class clazz)
get Classes Tree
List<Class<?>> classes = new ArrayList<Class<?>>();
classes.add(clazz);
if (clazz.isInterface()) {
    processInterface(clazz, classes);
} else {
    processClass(clazz, classes);
return classes;
...
ClassgetClassForDomain(String domain)
get Class For Domain
for (Map.Entry<Class, Set<String>> entry : CLASS_TO_DOMAINS.entrySet()) {
    if (entry.getValue().contains(domain))
        return entry.getKey();
throw new IllegalArgumentException("Unknown domain '" + domain + "'");
voidgetClassFQNString(Class clazz, StringBuilder sb)
get Class FQN String
Iterator<Class<?>> it = typeEnclosureHierarchy(clazz).descendingIterator();
while (it.hasNext()) {
    sb.append(it.next().getSimpleName());
    if (it.hasNext()) {
        sb.append(KEY_DELIM);