public static Number jsToNumber( Object value, String classType ) {
    if ( classType.equalsIgnoreCase( JS_UNDEFINED ) ) {
      return null;
    } else if ( classType.equalsIgnoreCase( JS_NATIVE_JAVA_OBJ ) ) {
      try {
        // Is it a java Value class ?
        Value v = (Value) Context.jsToJava( value, Value.class );
        return v.getNumber();
      } catch ( Exception e ) {
        String string = Context.toString( value );
        return Double.parseDouble( Const.trim( string ) );
      }
    } else if ( classType.equalsIgnoreCase( JS_NATIVE_NUM ) ) {
      Number nb = Context.toNumber( value );
      return nb.doubleValue();
    } else {
      Number nb = (Number) value;
      return nb.doubleValue();
    }
  }
@Test
  public void jsToNumber_NativeJavaObject_Double() throws Exception {
    Scriptable value = getDoubleValue();
    Number number = JavaScriptUtils.jsToNumber( value, JAVA_OBJECT );
    assertEquals( DOUBLE_ONE, number );
  }