Example usage for com.google.common.reflect ClassPath toString

List of usage examples for com.google.common.reflect ClassPath toString

Introduction

In this page you can find the example usage for com.google.common.reflect ClassPath toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:graphene.introspect.Introspector.java

public void introspect() {
    // TODO Auto-generated method stub
    ClassPath classPath = null;
    System.out.println("Starting introspection");
    try {//from  w w w  . j  av a  2  s . c  o m
        classPath = ClassPath.from(Introspector.class.getClassLoader());
        System.out.println("Starting introspection for " + classPath.toString());
        for (ClassPath.ClassInfo classInfo : classPath.getTopLevelClassesRecursive(beanPackageName)) {
            Class<?> c = classInfo.load();
            System.out.println("Loading fields for class " + c.getSimpleName());
            for (Field f : c.getFields()) {
                if (!Modifier.isStatic(f.getModifiers())) {
                    System.out.println(c.getName() + "." + f.getName());
                }
            }
            if (c.getSimpleName().startsWith("Q")) {
                queryClasses.put(c.getSimpleName(), c);
            } else {
                domainClasses.put(c.getSimpleName(), c);
            }
            // learnAboutClass(c);
        }
    } catch (IOException e) {
        logger.error(e.getMessage());
    }
    for (String s : domainClasses.keySet()) {
        Class q = queryClasses.get("Q" + s);
        if (q != null) {

            learnAbout(domainClasses.get(s), q);
        } else {
            // tablename might start with a q?
            logger.error("Could not find query class for " + s);
        }
    }

}