本文整理匯總了Java中netscape.javascript.JSObject.getSlot方法的典型用法代碼示例。如果您正苦於以下問題:Java JSObject.getSlot方法的具體用法?Java JSObject.getSlot怎麽用?Java JSObject.getSlot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類netscape.javascript.JSObject
的用法示例。
在下文中一共展示了JSObject.getSlot方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processResponse
import netscape.javascript.JSObject; //導入方法依賴的package包/類
/** Processess the Javascript response and generates the required objects
* that are then passed back to the original callback.
*
* @param results
* @param status
*/
public void processResponse(Object results, Object status) {
ElevationStatus pStatus = ElevationStatus.UNKNOWN_ERROR;
if (status instanceof String && results instanceof JSObject) {
pStatus = ElevationStatus.valueOf((String) status);
if (ElevationStatus.OK.equals(pStatus)) {
JSObject jsres = (JSObject) results;
Object len = jsres.getMember("length");
if (len instanceof Number) {
int n = ((Number)len).intValue();
// System.out.println("n: " + n);
ElevationResult[] ers = new ElevationResult[n];
for (int i = 0; i < n; i++) {
Object obj = jsres.getSlot(i);
if (obj instanceof JSObject) {
ers[i] = new ElevationResult((JSObject) obj);
}
}
callback.elevationsReceived(ers, pStatus);
return;
}
}
}
callback.elevationsReceived(new ElevationResult[]{}, pStatus);
}
示例2: jsArrayToList
import netscape.javascript.JSObject; //導入方法依賴的package包/類
public static List<?> jsArrayToList(JSObject objectArray)
{
List<Object> javaList = new ArrayList<>();
int objectArrayLength = (int) objectArray.getMember("length");
for(int index = 0; index < objectArrayLength; index++)
{
Object arrayVariable = objectArray.getSlot(index);
javaList.add(arrayVariable);
}
return javaList;
}