Search in sources :

Example 76 with StructImpl

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

the class DebuggerUtil method pointOutClosuresInPersistentScopes.

public Struct pointOutClosuresInPersistentScopes(PageContext pc) {
    Struct sct = new StructImpl();
    Set<Object> done = new HashSet<Object>();
    // Application Scope
    try {
        sct.set(KeyConstants._application, _pointOutClosuresInPersistentScopes(pc, pc.applicationScope(), done));
    } catch (PageException e) {
    }
    // Session Scope
    try {
        sct.set(KeyConstants._application, _pointOutClosuresInPersistentScopes(pc, pc.sessionScope(), done));
    } catch (PageException e) {
    }
    // Server Scope
    try {
        sct.set(KeyConstants._application, _pointOutClosuresInPersistentScopes(pc, pc.serverScope(), done));
    } catch (PageException e) {
    }
    return null;
}
Also used : PageException(lucee.runtime.exp.PageException) StructImpl(lucee.runtime.type.StructImpl) Struct(lucee.runtime.type.Struct) HashSet(java.util.HashSet)

Example 77 with StructImpl

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

the class DumpUtil method toArray2.

private static Array toArray2(List<PackageQuery> list) {
    Struct sct, _sct;
    Array arr = new ArrayImpl(), _arr;
    Iterator<PackageQuery> it = list.iterator();
    PackageQuery pd;
    Iterator<VersionDefinition> _it;
    VersionDefinition vd;
    while (it.hasNext()) {
        pd = it.next();
        sct = new StructImpl();
        sct.setEL(KeyConstants._package, pd.getName());
        sct.setEL("versions", _arr = new ArrayImpl());
        _it = pd.getVersionDefinitons().iterator();
        while (_it.hasNext()) {
            vd = _it.next();
            _sct = new StructImpl();
            _sct.setEL(KeyConstants._bundleVersion, vd.getVersion().toString());
            _sct.setEL("operator", vd.getOpAsString());
            _arr.appendEL(_sct);
        }
        arr.appendEL(sct);
    }
    return arr;
}
Also used : Array(lucee.runtime.type.Array) VersionDefinition(lucee.runtime.osgi.OSGiUtil.VersionDefinition) StructImpl(lucee.runtime.type.StructImpl) PackageQuery(lucee.runtime.osgi.OSGiUtil.PackageQuery) ArrayImpl(lucee.runtime.type.ArrayImpl) Struct(lucee.runtime.type.Struct)

Example 78 with StructImpl

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

the class Filter method invoke.

private static Struct invoke(PageContext pc, Iteratorable i, UDF udf, ExecutorService es, List<Future<Data<Pair<Object, Object>>>> futures) throws PageException {
    Iterator<Entry<Key, Object>> it = i.entryIterator();
    Struct rtn = new StructImpl();
    Entry<Key, Object> e;
    boolean async = es != null;
    Object res;
    while (it.hasNext()) {
        e = it.next();
        res = _inv(pc, udf, new Object[] { e.getKey().getString(), e.getValue() }, e.getKey(), e.getValue(), es, futures);
        if (!async && Caster.toBooleanValue(res))
            rtn.set(e.getKey(), e.getValue());
    }
    return rtn;
}
Also used : Entry(java.util.Map.Entry) StructImpl(lucee.runtime.type.StructImpl) Key(lucee.runtime.type.Collection.Key) ArgumentIntKey(lucee.runtime.type.scope.ArgumentIntKey) Struct(lucee.runtime.type.Struct)

Example 79 with StructImpl

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

the class Map method invoke.

private static Struct invoke(PageContext pc, Struct sct, UDF udf, ExecutorService es, List<Future<Data<Object>>> futures) throws PageException {
    Struct rtn = sct instanceof StructImpl ? new StructImpl(((StructImpl) sct).getType()) : new StructImpl();
    Iterator<Entry<Key, Object>> it = sct.entryIterator();
    Entry<Key, Object> e;
    boolean async = es != null;
    Object res;
    while (it.hasNext()) {
        e = it.next();
        res = _inv(pc, udf, new Object[] { e.getKey().getString(), e.getValue(), sct }, e.getKey(), es, futures);
        if (!async)
            rtn.set(e.getKey(), res);
    }
    return rtn;
}
Also used : Entry(java.util.Map.Entry) StructImpl(lucee.runtime.type.StructImpl) Key(lucee.runtime.type.Collection.Key) ArgumentIntKey(lucee.runtime.type.scope.ArgumentIntKey) Struct(lucee.runtime.type.Struct)

Example 80 with StructImpl

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

the class ComponentInfo method call.

public static Struct call(PageContext pc, Component component) {
    DeprecatedUtil.function(pc, "ComponentInfo", "GetMetaData");
    Struct sct = new StructImpl();
    sct.setEL(KeyConstants._name, component.getName());
    sct.setEL(KeyConstants._fullname, component.getCallName());
    String extend = component.getExtends();
    // TODO Object instead?
    if (extend == null || extend.length() == 0)
        extend = "Component";
    sct.setEL(KeyConstants._extends, extend);
    sct.setEL(KeyConstants._hint, component.getHint());
    return sct;
}
Also used : StructImpl(lucee.runtime.type.StructImpl) Struct(lucee.runtime.type.Struct)

Aggregations

StructImpl (lucee.runtime.type.StructImpl)251 Struct (lucee.runtime.type.Struct)216 PageException (lucee.runtime.exp.PageException)40 Entry (java.util.Map.Entry)34 Key (lucee.runtime.type.Collection.Key)28 Array (lucee.runtime.type.Array)25 ArrayImpl (lucee.runtime.type.ArrayImpl)24 ApplicationException (lucee.runtime.exp.ApplicationException)21 IOException (java.io.IOException)19 Map (java.util.Map)19 Resource (lucee.commons.io.res.Resource)18 Iterator (java.util.Iterator)17 PageContextImpl (lucee.runtime.PageContextImpl)14 QueryImpl (lucee.runtime.type.QueryImpl)13 Collection (lucee.runtime.type.Collection)11 Query (lucee.runtime.type.Query)11 DateTimeImpl (lucee.runtime.type.dt.DateTimeImpl)11 HashMap (java.util.HashMap)9 PageSource (lucee.runtime.PageSource)8 Element (org.w3c.dom.Element)8