Search in sources :

Example 11 with UDFPlus

use of lucee.runtime.type.UDFPlus in project Lucee by lucee.

the class ComponentImpl method callGetter.

private Object callGetter(PageContext pc, Collection.Key key, Object defaultValue) {
    Key getterName = KeyImpl.getInstance("get" + key.getLowerString());
    Member member = getMember(pc, getterName, false, false);
    if (member instanceof UDFPlus) {
        UDFPlus udf = (UDFPlus) member;
        if (udf.getFunctionArguments().length == 0 && udf.getReturnType() != CFTypes.TYPE_VOID) {
            try {
                return _call(pc, getterName, udf, null, ArrayUtil.OBJECT_EMPTY);
            } catch (PageException e) {
                return defaultValue;
            }
        }
    }
    return defaultValue;
}
Also used : PageException(lucee.runtime.exp.PageException) UDFPlus(lucee.runtime.type.UDFPlus) Member(lucee.runtime.component.Member) DataMember(lucee.runtime.component.DataMember) ArgumentIntKey(lucee.runtime.type.scope.ArgumentIntKey)

Example 12 with UDFPlus

use of lucee.runtime.type.UDFPlus in project Lucee by lucee.

the class Operator method isComparableComponent.

private static boolean isComparableComponent(Castable c) {
    if (!(c instanceof Component))
        return false;
    Member member = ((Component) c).getMember(Component.ACCESS_PRIVATE, KeyConstants.__compare, false, false);
    if (!(member instanceof UDFPlus))
        return false;
    UDFPlus udf = (UDFPlus) member;
    if (udf.getReturnType() == CFTypes.TYPE_NUMERIC && udf.getFunctionArguments().length == 1) {
        return true;
    }
    return false;
}
Also used : UDFPlus(lucee.runtime.type.UDFPlus) Component(lucee.runtime.Component) Member(lucee.runtime.component.Member)

Aggregations

UDFPlus (lucee.runtime.type.UDFPlus)12 Member (lucee.runtime.component.Member)9 DataMember (lucee.runtime.component.DataMember)5 ArgumentIntKey (lucee.runtime.type.scope.ArgumentIntKey)4 ExpressionException (lucee.runtime.exp.ExpressionException)3 Component (lucee.runtime.Component)2 UDF (lucee.runtime.type.UDF)2 ResultSet (java.sql.ResultSet)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Entry (java.util.Map.Entry)1 Set (java.util.Set)1 PageContext (lucee.runtime.PageContext)1 ThreadLocalPageContext (lucee.runtime.engine.ThreadLocalPageContext)1 ApplicationException (lucee.runtime.exp.ApplicationException)1 CasterException (lucee.runtime.exp.CasterException)1 PageException (lucee.runtime.exp.PageException)1 JavaObject (lucee.runtime.java.JavaObject)1 XMLMultiElementArray (lucee.runtime.text.xml.struct.XMLMultiElementArray)1 XMLMultiElementStruct (lucee.runtime.text.xml.struct.XMLMultiElementStruct)1