code: public static long toLongValue(Object o) throws PageException {
  	if (o instanceof Boolean) return ((((Boolean) o).booleanValue()) ? 1L : 0L);
  	else if (o instanceof Number) return (((Number) o).longValue());
  	else if (o instanceof CharSequence) {
  	    String str = o.toString();
  	    try {
  		return Long.parseLong(str);
  	    }
  	    catch (NumberFormatException nfe) {
  		return (long) toDoubleValue(str);
  	    }
  	}
  	else if (o instanceof Character) return (((Character) o).charValue());
  	else if (o instanceof Castable) return (long) ((Castable) o).castToDoubleValue();
  	else if (o instanceof ObjectWrap) return toLongValue(((ObjectWrap) o).getEmbededObject());
  
  	throw new CasterException(o, "long");
      }
docs: cast a Object to a long value (primitive value type)
  
  @param o Object to cast
  @return casted long value
  @throws PageException