code: public static Object castTo(PageContext pc, short type, Object o) throws PageException {
  	if (type == CFTypes.TYPE_ANY) return o;
  	else if (type == CFTypes.TYPE_ARRAY) return toArray(o);
  	else if (type == CFTypes.TYPE_BOOLEAN) return toBoolean(o);
  	else if (type == CFTypes.TYPE_BINARY) return toBinary(o);
  	else if (type == CFTypes.TYPE_DATETIME) return DateCaster.toDateAdvanced(o, pc.getTimeZone());
  	else if (type == CFTypes.TYPE_NUMERIC) return toDouble(o);
  	else if (type == CFTypes.TYPE_QUERY) return toQuery(o);
  	else if (type == CFTypes.TYPE_QUERY_COLUMN) return toQueryColumn(o);
  	else if (type == CFTypes.TYPE_STRING) return toString(o);
  	else if (type == CFTypes.TYPE_STRUCT) return toStruct(o);
  	else if (type == CFTypes.TYPE_TIMESPAN) return toTimespan(o);
  	else if (type == CFTypes.TYPE_UUID) return toGUId(o);
  	else if (type == CFTypes.TYPE_UUID) return toUUId(o);
  	else if (type == CFTypes.TYPE_VARIABLE_NAME) return toVariableName(o);
  	else if (type == CFTypes.TYPE_VOID) return toVoid(o);
  	else if (type == CFTypes.TYPE_FUNCTION) return toFunction(o);
  	else if (type == CFTypes.TYPE_XML) return toXML(o);
  	// ext.img else if(type==CFTypes.TYPE_IMAGE) return ImageUtil.toImage(pc,o,true);
  
  	if (type == CFTypes.TYPE_UNDEFINED) throw new ExpressionException("type isn't defined (TYPE_UNDEFINED)");
  	throw new ExpressionException("invalid type [" + type + "]");
      }
docs: cast a value to a value defined by type argument
  
  @param pc
  @param type type of the returning Value
  @param o Object to cast
  @return casted Value
  @throws PageException