Search in sources :

Example 1 with InterfacePageImpl

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

the class ComponentLoader method initComponent.

private static ComponentImpl initComponent(PageContext pc, CIPage page, String callPath, boolean isRealPath, final boolean isExtendedComponent, boolean executeConstr) throws PageException {
    // is not a component, then it has to be a interface
    if (!(page instanceof ComponentPageImpl))
        throw new ApplicationException("you cannot instantiate the interface [" + page.getPageSource().getDisplayPath() + "] as a component (" + page.getClass().getName() + "" + (page instanceof InterfacePageImpl) + ")");
    ComponentPageImpl cp = (ComponentPageImpl) page;
    ComponentImpl c = cp.newInstance(pc, callPath, isRealPath, isExtendedComponent, executeConstr);
    // abstract/final check
    if (!isExtendedComponent) {
        if (c.getModifier() == Component.MODIFIER_ABSTRACT)
            throw new ApplicationException("you cannot instantiate an abstract component [" + page.getPageSource().getDisplayPath() + "], this component can only be extended by other components");
    } else if (c.getModifier() == Component.MODIFIER_FINAL)
        throw new ApplicationException("you cannot extend a final component [" + page.getPageSource().getDisplayPath() + "]");
    c.setInitalized(true);
    return c;
}
Also used : InterfacePageImpl(lucee.runtime.InterfacePageImpl) ApplicationException(lucee.runtime.exp.ApplicationException) ComponentPageImpl(lucee.runtime.ComponentPageImpl) ComponentImpl(lucee.runtime.ComponentImpl)

Example 2 with InterfacePageImpl

use of lucee.runtime.InterfacePageImpl 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)

Aggregations

InterfacePageImpl (lucee.runtime.InterfacePageImpl)2 ApplicationException (lucee.runtime.exp.ApplicationException)2 ComponentImpl (lucee.runtime.ComponentImpl)1 ComponentPageImpl (lucee.runtime.ComponentPageImpl)1 InterfaceImpl (lucee.runtime.InterfaceImpl)1