Bug 984458 - f. Add NativeJSObject opt getters; r=blassey

This commit is contained in:
Jim Chen
2014-04-01 15:16:56 -04:00
parent 3c6863fec9
commit 552d824a97
3 changed files with 240 additions and 5 deletions

View File

@@ -43,6 +43,24 @@ public class NativeJSObject
*/
public native boolean getBoolean(String name);
/**
* Returns the value of a boolean property.
*
* @param name
* Property name
* @param fallback
* Value to return if property does not exist
* @throws IllegalArgumentException
* If the property exists and its type does not match the return type
* @throws NullPointerException
* If name is null or if this JS object has been disposed
* @throws IllegalThreadStateException
* If not called on the thread this object is attached to
* @throws UnsupportedOperationException
* If an internal JSAPI call failed
*/
public native boolean optBoolean(String name, boolean fallback);
/**
* Returns the value of a double property.
*
@@ -59,6 +77,24 @@ public class NativeJSObject
*/
public native double getDouble(String name);
/**
* Returns the value of a double property.
*
* @param name
* Property name
* @param fallback
* Value to return if property does not exist
* @throws IllegalArgumentException
* If the property exists and its type does not match the return type
* @throws NullPointerException
* If name is null or if this JS object has been disposed
* @throws IllegalThreadStateException
* If not called on the thread this object is attached to
* @throws UnsupportedOperationException
* If an internal JSAPI call failed
*/
public native double optDouble(String name, double fallback);
/**
* Returns the value of an int property.
*
@@ -75,6 +111,24 @@ public class NativeJSObject
*/
public native int getInt(String name);
/**
* Returns the value of an int property.
*
* @param name
* Property name
* @param fallback
* Value to return if property does not exist
* @throws IllegalArgumentException
* If the property exists and its type does not match the return type
* @throws NullPointerException
* If name is null or if this JS object has been disposed
* @throws IllegalThreadStateException
* If not called on the thread this object is attached to
* @throws UnsupportedOperationException
* If an internal JSAPI call failed
*/
public native int optInt(String name, int fallback);
/**
* Returns the value of an object property.
*
@@ -91,6 +145,24 @@ public class NativeJSObject
*/
public native NativeJSObject getObject(String name);
/**
* Returns the value of an object property.
*
* @param name
* Property name
* @param fallback
* Value to return if property does not exist
* @throws IllegalArgumentException
* If the property exists and its type does not match the return type
* @throws NullPointerException
* If name is null or if this JS object has been disposed
* @throws IllegalThreadStateException
* If not called on the thread this object is attached to
* @throws UnsupportedOperationException
* If an internal JSAPI call failed
*/
public native NativeJSObject optObject(String name, NativeJSObject fallback);
/**
* Returns the value of a string property.
*
@@ -107,6 +179,24 @@ public class NativeJSObject
*/
public native String getString(String name);
/**
* Returns the value of a string property.
*
* @param name
* Property name
* @param fallback
* Value to return if property does not exist
* @throws IllegalArgumentException
* If the property exists and its type does not match the return type
* @throws NullPointerException
* If name is null or if this JS object has been disposed
* @throws IllegalThreadStateException
* If not called on the thread this object is attached to
* @throws UnsupportedOperationException
* If an internal JSAPI call failed
*/
public native String optString(String name, String fallback);
/**
* Returns whether a property exists in this object
*