Search in sources :

Example 6 with VariableUtilImpl

use of lucee.runtime.util.VariableUtilImpl in project Lucee by lucee.

the class TOObjects method setEL.

@Override
public Object setEL(PageContext pc, Key key, Object value) {
    log(key, value);
    VariableUtilImpl var = (VariableUtilImpl) pc.getVariableUtil();
    return var.setEL(pc, o, key, value);
// return TraceObjectSupport.toTraceObject(debugger,var.setEL(pc, o, key, value),type,category,text);
}
Also used : VariableUtilImpl(lucee.runtime.util.VariableUtilImpl)

Example 7 with VariableUtilImpl

use of lucee.runtime.util.VariableUtilImpl in project Lucee by lucee.

the class TOObjects method call.

@Override
public Object call(PageContext pc, Key key, Object[] args) throws PageException {
    log(key.getString());
    VariableUtilImpl var = (VariableUtilImpl) pc.getVariableUtil();
    return var.callFunctionWithoutNamedValues(pc, o, key, args);
}
Also used : VariableUtilImpl(lucee.runtime.util.VariableUtilImpl)

Example 8 with VariableUtilImpl

use of lucee.runtime.util.VariableUtilImpl in project Lucee by lucee.

the class TOObjects method get.

@Override
public Object get(PageContext pc, Key key, Object defaultValue) {
    log(key.getString());
    VariableUtilImpl var = (VariableUtilImpl) pc.getVariableUtil();
    return var.get(pc, o, key, defaultValue);
// return TraceObjectSupport.toTraceObject(debugger,var.get(pc, o, key, defaultValue),type,category,text);
}
Also used : VariableUtilImpl(lucee.runtime.util.VariableUtilImpl)

Example 9 with VariableUtilImpl

use of lucee.runtime.util.VariableUtilImpl in project Lucee by lucee.

the class JavaObject method set.

@Override
public Object set(PageContext pc, Collection.Key propertyName, Object value) throws PageException {
    if (isInit) {
        return ((VariableUtilImpl) variableUtil).set(pc, object, propertyName, value);
    }
    // Field
    Field[] fields = Reflector.getFieldsIgnoreCase(clazz, propertyName.getString(), null);
    if (!ArrayUtil.isEmpty(fields) && Modifier.isStatic(fields[0].getModifiers())) {
        try {
            fields[0].set(null, value);
            return value;
        } catch (Exception e) {
            Caster.toPageException(e);
        }
    }
    // Getter
    MethodInstance mi = Reflector.getSetter(clazz, propertyName.getString(), value, null);
    if (mi != null) {
        if (Modifier.isStatic(mi.getMethod().getModifiers())) {
            try {
                return mi.invoke(null);
            } catch (IllegalAccessException e) {
                throw Caster.toPageException(e);
            } catch (InvocationTargetException e) {
                throw Caster.toPageException(e.getTargetException());
            }
        }
    }
    return ((VariableUtilImpl) variableUtil).set(pc, init(), propertyName, value);
}
Also used : Field(java.lang.reflect.Field) MethodInstance(lucee.runtime.reflection.pairs.MethodInstance) VariableUtilImpl(lucee.runtime.util.VariableUtilImpl) PageException(lucee.runtime.exp.PageException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ExpressionException(lucee.runtime.exp.ExpressionException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

VariableUtilImpl (lucee.runtime.util.VariableUtilImpl)9 Field (java.lang.reflect.Field)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ExpressionException (lucee.runtime.exp.ExpressionException)1 PageException (lucee.runtime.exp.PageException)1 MethodInstance (lucee.runtime.reflection.pairs.MethodInstance)1