Make GeckoEmbed functions more Java-like. Don't reflect NS_NewArray. Provide generic impl of QI.

git-svn-id: svn://10.0.0.236/trunk@163854 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pedemont%us.ibm.com
2004-10-15 21:50:15 +00:00
parent 8dd6cc7e13
commit 9c67210ecd
3 changed files with 24 additions and 105 deletions

View File

@@ -70,6 +70,17 @@ public final class XPCOM {
/* Utility functions */
// Generic QueryInterface implementation
public static nsISupports queryInterface(nsISupports aObject, String aIID)
{
Class[] interfaces = aObject.getClass().getInterfaces();
for (int i = 0; i < interfaces.length; i++ ) {
if (aIID.equals(XPCOM.getInterfaceIID(interfaces[i])))
return aObject;
}
return null;
}
// Given an interface, this will construct the name of the IID field (such as
// NS_ISUPPORTS_IID) and return its value.
public static String getInterfaceIID(Class aInterface)