Search in sources :

Example 1 with DataMember

use of lucee.runtime.component.DataMember in project Lucee by lucee.

the class ComponentImpl method _set.

/**
 * sets a value to the current Component, dont to base Component
 * @param key
 * @param value
 * @return value set
 * @throws ExpressionException
 */
private Object _set(PageContext pc, Collection.Key key, Object value) throws ExpressionException {
    if (value instanceof Member) {
        if (value instanceof UDFPlus) {
            UDFPlus udf = (UDFPlus) ((UDFPlus) value).duplicate();
            // udf.isComponentMember(true);///+++
            udf.setOwnerComponent(this);
            if (udf.getAccess() > Component.ACCESS_PUBLIC)
                udf.setAccess(Component.ACCESS_PUBLIC);
            _data.put(key, udf);
            _udfs.put(key, udf);
            hasInjectedFunctions = true;
        } else
            _data.put(key, (Member) value);
    } else {
        Member existing = _data.get(key);
        if (loaded && !isAccessible(pc, existing != null ? existing.getAccess() : dataMemberDefaultAccess))
            throw new ExpressionException("Component [" + getCallName() + "] has no accessible Member with name [" + key + "]", "enable [trigger data member] in admininistrator to also invoke getters and setters");
        _data.put(key, new DataMember(existing != null ? existing.getAccess() : dataMemberDefaultAccess, existing != null ? existing.getModifier() : Member.MODIFIER_NONE, value));
    }
    return value;
}
Also used : DataMember(lucee.runtime.component.DataMember) UDFPlus(lucee.runtime.type.UDFPlus) Member(lucee.runtime.component.Member) DataMember(lucee.runtime.component.DataMember) ExpressionException(lucee.runtime.exp.ExpressionException)

Aggregations

DataMember (lucee.runtime.component.DataMember)1 Member (lucee.runtime.component.Member)1 ExpressionException (lucee.runtime.exp.ExpressionException)1 UDFPlus (lucee.runtime.type.UDFPlus)1