Search in sources :

Example 1 with ClassNode

use of act.util.ClassNode in project actframework by actframework.

the class ResultClassLookup method loadResultClasses.

private void loadResultClasses() {
    final String RESULT = Result.class.getName();
    _set.add(RESULT);
    ClassInfoRepository repo = Act.app().classLoader().classInfoRepository();
    ClassNode resultNode = repo.node(RESULT);
    if (null == resultNode) {
        // inside unit test
        add(Ok.class, NotFound.class, ErrorResult.class, NotAcceptable.class, Forbidden.class, NotImplemented.class, BadRequest.class, Conflict.class, MethodNotAllowed.class, Unauthorized.class, ServerError.class, NotModified.class, RenderBinary.class, Accepted.class, Created.class, NoResult.class, Redirect.class, RenderTemplate.class, RenderAny.class, ZXingResult.class, RenderJsonMap.class, RenderJSON.class, RenderContent.class, RenderXML.class, RenderCSV.class, RenderHtml.class, FilteredRenderJSON.class, FilteredRenderXML.class, RenderText.class);
    } else {
        resultNode.visitPublicSubTreeNodes(new $.Visitor<ClassNode>() {

            @Override
            public void visit(ClassNode classNode) throws Osgl.Break {
                _set.add(classNode.name());
            }
        });
    }
}
Also used : ClassNode(act.util.ClassNode) org.osgl.$(org.osgl.$) ClassInfoRepository(act.util.ClassInfoRepository)

Example 2 with ClassNode

use of act.util.ClassNode in project actframework by actframework.

the class ControllerClassMetaInfo method getAllWithList.

private void getAllWithList(final Set<String> withList, final ControllerClassMetaInfoManager infoBase) {
    withList.addAll(this.withList);
    if (null != superType) {
        final String superClass = superType.getClassName();
        App app = App.instance();
        ClassInfoRepository repo = app.classLoader().classInfoRepository();
        ControllerClassMetaInfo info = infoBase.controllerMetaInfo(superClass);
        String curSuperClass = superClass;
        while (null == info && !"java.lang.Object".equals(curSuperClass)) {
            ClassNode node = repo.node(curSuperClass);
            if (null != node) {
                node = node.parent();
            }
            if (null == node) {
                break;
            }
            curSuperClass = node.name();
            info = infoBase.controllerMetaInfo(curSuperClass);
        }
        if (null != info) {
            withList.add(superClass);
        }
    }
}
Also used : App(act.app.App) ClassNode(act.util.ClassNode) ClassInfoRepository(act.util.ClassInfoRepository)

Example 3 with ClassNode

use of act.util.ClassNode in project actframework by actframework.

the class ControllerClassMetaInfo method parent.

public ControllerClassMetaInfo parent(boolean checkClassInfoRepo) {
    if (null != parent) {
        return parent;
    }
    if (!checkClassInfoRepo) {
        return null;
    }
    AppClassLoader classLoader = Act.app().classLoader();
    ClassInfoRepository repo = classLoader.classInfoRepository();
    ClassNode parentNode = repo.node(superType.getClassName());
    while (null != parentNode) {
        parentNode = parentNode.parent();
        if (null != parentNode) {
            ControllerClassMetaInfo parentInfo = classLoader.controllerClassMetaInfo(parentNode.name());
            if (null != parentInfo) {
                return parentInfo;
            }
        } else {
            return null;
        }
    }
    return null;
}
Also used : ClassNode(act.util.ClassNode) AppClassLoader(act.app.AppClassLoader) ClassInfoRepository(act.util.ClassInfoRepository)

Example 4 with ClassNode

use of act.util.ClassNode in project actframework by actframework.

the class ControllerClassMetaInfoManager method buildSuperClassMetaInfo.

private static void buildSuperClassMetaInfo(ControllerClassMetaInfo info, ControllerClassMetaInfoManager manager, ClassInfoRepository repo) {
    String className = info.className();
    ClassNode node = repo.node(className);
    if (null == node) {
        return;
    }
    ClassNode parent = node.parent();
    final String OBJECT = Object.class.getName();
    while (null != parent && !OBJECT.equals(parent.name())) {
        ControllerClassMetaInfo parentInfo = manager.controllerMetaInfo(parent.name());
        if (null != parentInfo) {
            info.parent(parentInfo);
            break;
        }
        parent = parent.parent();
    }
}
Also used : ClassNode(act.util.ClassNode)

Example 5 with ClassNode

use of act.util.ClassNode in project actframework by actframework.

the class EntityClassMetaInfo method mergeFromMappedSuperClasses.

void mergeFromMappedSuperClasses(ClassInfoRepository classRepo, EntityMetaInfoRepo entityRepo) {
    ClassNode node = classRepo.node(getClass().getName());
    ClassNode parent = node.parent();
    if (null != parent) {
        mergeFrom(parent, entityRepo);
    }
}
Also used : ClassNode(act.util.ClassNode)

Aggregations

ClassNode (act.util.ClassNode)12 ClassInfoRepository (act.util.ClassInfoRepository)6 AppClassLoader (act.app.AppClassLoader)2 ArrayList (java.util.ArrayList)2 org.osgl.$ (org.osgl.$)2 C (org.osgl.util.C)2 App (act.app.App)1 Osgl (org.osgl.Osgl)1