Search in sources :

Example 1 with ComponentPageImpl

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

Aggregations

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