converts a object to a QueryColumn, if possible, also variable declarations are allowed. this
method is used within the generated bytecode

@param o
@return
@throws PageException
@info used in bytecode generation
427357
public static QueryColumn toQueryColumn(Object o, PageContext pc) throws PageException {
	if (o instanceof QueryColumn) return (QueryColumn) o;
	if (o instanceof String) {
	    o = VariableInterpreter.getVariableAsCollection(pc, (String) o);
	    if (o instanceof QueryColumn) return (QueryColumn) o;
	}

	throw new CasterException(o, "querycolumn");
    }
716660
public static boolean toBooleanValue(Object o) throws PageException {
	if (o instanceof Boolean) return ((Boolean) o).booleanValue();
	else if (o instanceof Number) return toBooleanValue(((Number) o).doubleValue());
	else if (o instanceof String) return toBooleanValue((String) o);
	else if (o instanceof Castable) return ((Castable) o).castToBooleanValue();
	else if (o == null) return toBooleanValue("");
	else if (o instanceof ObjectWrap) return toBooleanValue(((ObjectWrap) o).getEmbededObject());
	throw new CasterException(o, "boolean");
    }
288321
private Object _deserializeQuery(Element recordset) throws ConverterException {
	try {
	    // create Query Object
	    Query query = new QueryImpl(lucee.runtime.type.util.ListUtil.listToArray(recordset.getAttribute("fieldNames"), ','),
		    Caster.toIntValue(recordset.getAttribute("rowCount")), "query");

	    NodeList list = recordset.getChildNodes();
	    int len = list.getLength();
	    for (int i = 0; i < len; i++) {
		Node node = list.item(i);
		if (node instanceof Element) {
		    _deserializeQueryField(query, (Element) node);
		}
	    }
	    return query;
	}
	catch (PageException e) {
	    throw toConverterException(e);
	}

    }
1247996
public static Object recordcount(PageContext pc, Object obj) throws PageException {
	if (obj instanceof Query) return Caster.toDouble(((Query) obj).getRecordcount());
	return pc.getCollection(obj, KeyConstants._RECORDCOUNT);
    }
277370
@Override
	public int compareTo(ElementRef o) {
		int diff = pageRef.compareTo(o.pageRef);
		if(diff != 0) return diff;
		return id.compareTo(o.id);
	}
769419
public org.geolatte.geom.Geometry evaluate(Object o) {

        EntityClassReader classReader = EntityClassReader.getClassReaderFor(o.getClass(), null, "id");
        Object result = null;
        try {
            result = classReader.getPropertyValue(o, propertyName);
        }
        catch (InvalidObjectReaderException e) {
            ; // can never occur
        }

        if (!(result instanceof Geometry))
                return null;

        return (Geometry)result;
    }
18418
public static Object get(PageContext pc, Object coll, int[] types, Key[] keys, Object[][] args, Object defaultValue) throws PageException {
	if (coll == null) return defaultValue;
	int to = keys.length - 1;
	VariableUtilImpl vu = (VariableUtilImpl) pc.getVariableUtil();
	for (int i = 0; i <= to; i++) {
	    switch (types[i]) {
	    case TYPE_DATA:
		coll = vu.getCollection(pc, coll, keys[i], Null.NULL);
		break;
	    case TYPE_UDF_ARGS:
		coll = vu.callFunctionWithoutNamedValues(pc, coll, keys[i], args[i], false, Null.NULL);
		break;
	    case TYPE_UDF_NAMED_ARGS:
		coll = vu.callFunctionWithNamedValues(pc, coll, keys[i], args[i], false, Null.NULL);
		break;
	    case TYPE_BIF:
		coll = null;// TODO
		break;
	    }

	    if (coll == Null.NULL || (coll == null && i < to)) return defaultValue;
	}
	return coll;
    }
866901
public static String call(PageContext pc, Object var, boolean serializeQueryByColumns) throws PageException {
	return _call(pc, var, serializeQueryByColumns, pc.getWebCharset());
    }
1086614
public static Object call(PageContext pc, String sql, Object params, Struct options, String name) throws PageException {
	PageContextImpl pci = (PageContextImpl) pc;
	lucee.runtime.tag.Query qry = (lucee.runtime.tag.Query) pci.use(lucee.runtime.tag.Query.class.getName(), "cfquery", TagLibTag.ATTRIBUTE_TYPE_FIXED);

	try {
	    try {
		qry.hasBody(true);
		// set attributes
		qry.setReturnVariable(true);
		qry.setName(StringUtil.isEmpty(name) ? "QueryExecute" : name);
		if (options != null) TagUtil.setAttributeCollection(pc, qry, null, options, TagLibTag.ATTRIBUTE_TYPE_FIXED);
		qry.setParams(params);

		int res = qry.doStartTag();
		pc.initBody(qry, res);
		pc.forceWrite(sql);
		qry.doAfterBody();
	    }
	    catch (Throwable t) {
		ExceptionUtil.rethrowIfNecessary(t);
		try {
		    qry.doCatch(t);
		}
		catch (Throwable t2) {
		    ExceptionUtil.rethrowIfNecessary(t);
		    throw Caster.toPageException(t2);
		}
	    }
	    finally {
		pc.popBody();
		qry.doFinally();
	    }
	    qry.doEndTag();
	    return qry.getReturnVariable();
	}
	finally {
	    pci.reuse(qry);
	}

    }
374514
Object fromColumn(K id, com.netflix.astyanax.model.Column<ByteBuffer> c) {
        try {
            // Allocate a new entity
            Object entity         = clazz.newInstance();
            
            idMapper.setValue(entity, id);
            setEntityFieldsFromColumnName(entity, c.getRawName().duplicate());
            valueMapper.setField(entity, c.getByteBufferValue().duplicate());
            return entity;
        } catch(Exception e) {
            throw new PersistenceException("failed to construct entity", e);
        }
    }
1244537
private static Object toQuery(Object obj) throws PageException {
	if (obj instanceof Struct) {
	    Struct sct = (Struct) obj;
	    Key[] keys = CollectionUtil.keys(sct);

	    // Columns
	    Key[] columns = null;
	    if (contains(keys, KeyConstants._COLUMNS)) columns = toColumns(sct.get(KeyConstants._COLUMNS, null));
	    else if (contains(keys, KeyConstants._COLUMNLIST)) columns = toColumnlist(sct.get(KeyConstants._COLUMNLIST, null));

	    // rowcount
	    int rowcount = -1;
	    if (contains(keys, ROWCOUNT)) rowcount = toRowCount(sct.get(ROWCOUNT, null));
	    else if (contains(keys, KeyConstants._RECORDCOUNT)) rowcount = toRowCount(sct.get(KeyConstants._RECORDCOUNT, null));

	    if (columns != null) {
		if (keys.length == 2 && contains(keys, KeyConstants._DATA)) {

		    Array[] data = toData(sct.get(KeyConstants._DATA, null), columns);
		    if (data != null) {
			return new QueryImpl(columns, data, "query");
		    }
		}

		else if (keys.length == 3 && rowcount != -1 && contains(keys, KeyConstants._DATA)) {
		    Array[] data = toData(sct.get(KeyConstants._DATA, null), columns, rowcount);
		    if (data != null) {
			return new QueryImpl(columns, data, "query");
		    }
		}
	    }
	    return toQuery(sct, keys);
	}
	/*
	 * else if(obj instanceof Query) { return toQuery((Query) obj); }
	 */
	else if (obj instanceof Collection) {
	    Collection coll = (Collection) obj;
	    return toQuery(coll, CollectionUtil.keys(coll));
	}

	return obj;

    }
550490
@Override
	public <T> PagedLater<T> paged(String object, Class<T> type, Param... params) {
		return this.getBatchForGraph().paged(object, type, params);
	}
949976
public static Attr toAttr(Document doc, Object o) throws PageException {
	if (o instanceof Attr) return (Attr) o;
	if (o instanceof Struct && ((Struct) o).size() == 1) {
	    Struct sct = (Struct) o;
	    Entry<Key, Object> e = sct.entryIterator().next();
	    Attr attr = doc.createAttribute(e.getKey().getString());
	    attr.setValue(Caster.toString(e.getValue()));
	    return attr;
	}

	throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Attribute");
    }
704565
public static Comment toComment(Document doc, Object o) throws PageException {
	if (o instanceof Comment) return (Comment) o;
	else if (o instanceof CharacterData) return doc.createComment(((CharacterData) o).getData());
	return doc.createComment(Caster.toString(o));
    }
714181
public static Query toQuery(Object o) throws PageException {
	if (o instanceof Query) return (Query) o;
	if (o instanceof ObjectWrap) {
	    return toQuery(((ObjectWrap) o).getEmbededObject());
	}
	if (o instanceof ResultSet) return new QueryImpl((ResultSet) o, "query", ThreadLocalPageContext.getTimeZone());
	if (o instanceof Component) {
	    Member member = ((Component) o).getMember(Component.ACCESS_PRIVATE, KeyConstants.__toQuery, false, false);
	    if (member instanceof UDFPlus) {
		UDFPlus udf = (UDFPlus) member;
		if (udf.getReturnType() == CFTypes.TYPE_QUERY && udf.getFunctionArguments().length == 0) {
		    return Caster.toQuery(((Component) o).call(ThreadLocalPageContext.get(), KeyConstants.__toQuery, new Object[] {}));
		}
	    }
	}

	throw new CasterException(o, "query");
    }
115971
public static Float toFloat(Object o) throws PageException {
	if (o instanceof Float) return (Float) o;
	return new Float(toFloatValue(o));
    }
1228190
public static NodeList toNodeList(Object o) throws PageException {
	// print.ln("nodeList:"+o);
	if (o instanceof NodeList) {
	    return (NodeList) o;
	}
	else if (o instanceof ObjectWrap) {
	    return toNodeList(((ObjectWrap) o).getEmbededObject());
	}
	throw new CasterException(o, "NodeList");
    }