Search in sources :

Example 76 with ArrayImpl

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

the class XMLConverter method _deserializeArray.

/**
 * Desirialize a Struct Object
 * @param el Struct Object as XML Element
 * @return Struct Object
 * @throws ConverterException
 */
private Array _deserializeArray(Element el) throws ConverterException {
    Array array = new ArrayImpl();
    NodeList list = el.getChildNodes();
    int len = list.getLength();
    for (int i = 0; i < len; i++) {
        Node node = list.item(i);
        if (node instanceof Element)
            try {
                array.append(_deserialize((Element) node));
            } catch (PageException e) {
                throw toConverterException(e);
            }
    }
    return array;
}
Also used : Array(lucee.runtime.type.Array) PageException(lucee.runtime.exp.PageException) ArrayImpl(lucee.runtime.type.ArrayImpl) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Element(org.w3c.dom.Element)

Example 77 with ArrayImpl

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

the class PageExceptionImpl method getTagContext.

public static Array getTagContext(Config config, StackTraceElement[] traces) {
    Array tagContext = new ArrayImpl();
    _getTagContext(config, tagContext, traces, new LinkedList<PageSource>());
    return tagContext;
}
Also used : Array(lucee.runtime.type.Array) ArrayImpl(lucee.runtime.type.ArrayImpl) PageSource(lucee.runtime.PageSource)

Example 78 with ArrayImpl

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

the class ArrayMerge method call.

public static Array call(PageContext pc, Array arr1, Array arr2, boolean leaveIndex) throws PageException {
    ArrayImpl arr = new ArrayImpl(true, arr1.size() + arr2.size());
    if (leaveIndex) {
        set(arr, arr2);
        set(arr, arr1);
        return arr;
    }
    append(arr, arr1);
    append(arr, arr2);
    return arr;
}
Also used : ArrayImpl(lucee.runtime.type.ArrayImpl)

Example 79 with ArrayImpl

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

the class CacheGetProperties method call.

public static Array call(PageContext pc, String cacheName) throws PageException {
    Array arr = new ArrayImpl();
    try {
        if (StringUtil.isEmpty(cacheName)) {
            addDefault(pc, Config.CACHE_TYPE_OBJECT, arr);
            addDefault(pc, Config.CACHE_TYPE_TEMPLATE, arr);
            addDefault(pc, Config.CACHE_TYPE_QUERY, arr);
            addDefault(pc, Config.CACHE_TYPE_RESOURCE, arr);
            addDefault(pc, Config.CACHE_TYPE_FUNCTION, arr);
            addDefault(pc, Config.CACHE_TYPE_INCLUDE, arr);
            addDefault(pc, Config.CACHE_TYPE_HTTP, arr);
            addDefault(pc, Config.CACHE_TYPE_FILE, arr);
            addDefault(pc, Config.CACHE_TYPE_WEBSERVICE, arr);
        // MUST welcher muss zuers sein
        } else {
            String name;
            String[] names = ListUtil.listToStringArray(cacheName, ',');
            for (int i = 0; i < names.length; i++) {
                name = names[i].trim();
                if (name.equalsIgnoreCase("template"))
                    arr.appendEL(CacheUtil.getDefault(pc, Config.CACHE_TYPE_TEMPLATE).getCustomInfo());
                else if (name.equalsIgnoreCase("object"))
                    arr.appendEL(CacheUtil.getDefault(pc, Config.CACHE_TYPE_OBJECT).getCustomInfo());
                else if (name.equalsIgnoreCase("query"))
                    arr.appendEL(CacheUtil.getDefault(pc, Config.CACHE_TYPE_QUERY).getCustomInfo());
                else if (name.equalsIgnoreCase("resource"))
                    arr.appendEL(CacheUtil.getDefault(pc, Config.CACHE_TYPE_RESOURCE).getCustomInfo());
                else if (name.equalsIgnoreCase("function"))
                    arr.appendEL(CacheUtil.getDefault(pc, Config.CACHE_TYPE_FUNCTION).getCustomInfo());
                else if (name.equalsIgnoreCase("include"))
                    arr.appendEL(CacheUtil.getDefault(pc, Config.CACHE_TYPE_INCLUDE).getCustomInfo());
                else if (name.equalsIgnoreCase("http"))
                    arr.appendEL(CacheUtil.getDefault(pc, Config.CACHE_TYPE_HTTP).getCustomInfo());
                else if (name.equalsIgnoreCase("file"))
                    arr.appendEL(CacheUtil.getDefault(pc, Config.CACHE_TYPE_FILE).getCustomInfo());
                else if (name.equalsIgnoreCase("webservice"))
                    arr.appendEL(CacheUtil.getDefault(pc, Config.CACHE_TYPE_WEBSERVICE).getCustomInfo());
                else
                    arr.appendEL(CacheUtil.getCache(pc, name).getCustomInfo());
            }
        }
        return arr;
    } catch (IOException e) {
        throw Caster.toPageException(e);
    }
}
Also used : Array(lucee.runtime.type.Array) ArrayImpl(lucee.runtime.type.ArrayImpl) IOException(java.io.IOException)

Example 80 with ArrayImpl

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

the class DebuggerPool method getData.

public Array getData(PageContext pc) {
    Iterator<Struct> it;
    synchronized (queue) {
        it = queue.iterator();
    }
    Array arr = new ArrayImpl();
    while (it.hasNext()) {
        arr.appendEL(it.next());
    }
    return arr;
}
Also used : Array(lucee.runtime.type.Array) ArrayImpl(lucee.runtime.type.ArrayImpl) Struct(lucee.runtime.type.Struct)

Aggregations

ArrayImpl (lucee.runtime.type.ArrayImpl)100 Array (lucee.runtime.type.Array)79 Struct (lucee.runtime.type.Struct)33 StructImpl (lucee.runtime.type.StructImpl)24 PageException (lucee.runtime.exp.PageException)14 Entry (java.util.Map.Entry)13 Key (lucee.runtime.type.Collection.Key)12 ArgumentIntKey (lucee.runtime.type.scope.ArgumentIntKey)8 IOException (java.io.IOException)7 Iterator (java.util.Iterator)7 ArrayList (java.util.ArrayList)6 ListIterator (java.util.ListIterator)6 FunctionException (lucee.runtime.exp.FunctionException)6 ForEachQueryIterator (lucee.runtime.type.it.ForEachQueryIterator)6 ApplicationException (lucee.runtime.exp.ApplicationException)5 ExpressionException (lucee.runtime.exp.ExpressionException)5 Query (lucee.runtime.type.Query)5 QueryImpl (lucee.runtime.type.QueryImpl)5 ListAsArray (lucee.runtime.type.wrap.ListAsArray)5 NodeList (org.w3c.dom.NodeList)5