Search in sources :

Example 1 with InterfaceImpl

use of lucee.runtime.InterfaceImpl in project Lucee by lucee.

the class ComponentLoader method initInterface.

private static InterfaceImpl initInterface(PageContext pc, Page page, String callPath, boolean isRealPath) throws PageException {
    if (!(page instanceof InterfacePageImpl))
        throw new ApplicationException("invalid interface definition [" + callPath + "]");
    InterfacePageImpl ip = (InterfacePageImpl) page;
    InterfaceImpl i = ip.newInstance(pc, callPath, isRealPath);
    return i;
}
Also used : InterfacePageImpl(lucee.runtime.InterfacePageImpl) ApplicationException(lucee.runtime.exp.ApplicationException) InterfaceImpl(lucee.runtime.InterfaceImpl)

Example 2 with InterfaceImpl

use of lucee.runtime.InterfaceImpl in project Lucee by lucee.

the class AbstractFinal method add.

public void add(List<InterfaceImpl> interfaces) {
    // add all interfaces to a flat structure
    Iterator<InterfaceImpl> it = interfaces.iterator();
    Iterator<UDF> iit;
    InterfaceImpl inter;
    UDF udf;
    while (it.hasNext()) {
        inter = it.next();
        List<InterfaceImpl> parents = inter._getExtends();
        // first add the parents, so children can overwrite functions with same name
        if (!ArrayUtil.isEmpty(parents))
            add(parents);
        // UDFs
        iit = inter.getUDFIt();
        while (iit.hasNext()) {
            udf = iit.next();
            add(udf);
        }
        // this is add to a map to ensure we have every interface only once
        this.interfaces.put(inter.getPageSource().getDisplayPath(), inter);
    }
}
Also used : InterfaceImpl(lucee.runtime.InterfaceImpl) UDF(lucee.runtime.type.UDF)

Example 3 with InterfaceImpl

use of lucee.runtime.InterfaceImpl in project Lucee by lucee.

the class ComponentLoader method loadInterface.

public static InterfaceImpl loadInterface(PageContext pc, Page page, PageSource ps, String callPath, boolean isRealPath) throws PageException {
    InterfaceImpl rtn = null;
    if (pc.getConfig().debug()) {
        DebugEntryTemplate debugEntry = pc.getDebugger().getEntry(pc, ps);
        pc.addPageSource(ps, true);
        long currTime = pc.getExecutionTime();
        long exeTime = 0;
        long time = System.nanoTime();
        try {
            debugEntry.updateFileLoadTime((int) (System.nanoTime() - time));
            exeTime = System.nanoTime();
            if (page == null)
                page = ps.loadPage(pc, false);
            rtn = initInterface(pc, page, callPath, isRealPath);
        } finally {
            long diff = ((System.nanoTime() - exeTime) - (pc.getExecutionTime() - currTime));
            pc.setExecutionTime(pc.getExecutionTime() + (System.nanoTime() - time));
            debugEntry.updateExeTime(diff);
            pc.removeLastPageSource(true);
        }
    } else // no debug
    {
        pc.addPageSource(ps, true);
        try {
            if (page == null)
                page = ps.loadPage(pc, false);
            rtn = initInterface(pc, page, callPath, isRealPath);
        } finally {
            pc.removeLastPageSource(true);
        }
    }
    return rtn;
}
Also used : DebugEntryTemplate(lucee.runtime.debug.DebugEntryTemplate) InterfaceImpl(lucee.runtime.InterfaceImpl)

Aggregations

InterfaceImpl (lucee.runtime.InterfaceImpl)3 InterfacePageImpl (lucee.runtime.InterfacePageImpl)1 DebugEntryTemplate (lucee.runtime.debug.DebugEntryTemplate)1 ApplicationException (lucee.runtime.exp.ApplicationException)1 UDF (lucee.runtime.type.UDF)1