use of lucee.runtime.functions.BIFProxy in project Lucee by lucee.
the class TagUtil method invokeBIF.
/**
* used by the bytecode builded
* @param pc pageContext
* @param className
* @param bundleName
* @param bundleVersion
* @return
* @throws BundleException
* @throws ClassException
*/
public static Object invokeBIF(PageContext pc, Object[] args, String className, String bundleName, String bundleVersion) throws PageException {
try {
Class<?> clazz = ClassUtil.loadClassByBundle(className, bundleName, bundleVersion, pc.getConfig().getIdentification());
BIF bif;
if (Reflector.isInstaneOf(clazz, BIF.class))
bif = (BIF) clazz.newInstance();
else
bif = new BIFProxy(clazz);
return bif.invoke(pc, args);
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
use of lucee.runtime.functions.BIFProxy in project Lucee by lucee.
the class ClassUtilImpl method loadBIF.
@Override
public BIF loadBIF(PageContext pc, String name) throws InstantiationException, IllegalAccessException {
// first of all we chek if itis a class
Class<?> res = lucee.commons.lang.ClassUtil.loadClass(name, null);
if (res != null) {
if (Reflector.isInstaneOf(res, BIF.class)) {
return (BIF) res.newInstance();
}
return new BIFProxy(res);
}
FunctionLib[] flds = ((ConfigWebImpl) pc.getConfig()).getFLDs(pc.getCurrentTemplateDialect());
FunctionLibFunction flf;
for (int i = 0; i < flds.length; i++) {
flf = flds[i].getFunction(name);
if (flf != null)
return flf.getBIF();
}
return null;
}
Aggregations