Hello:
I am working with the Bridge2Java API from the IBM AlphaWorks.
Bridge2Java allows
java to communicate with ActiveX objects under Windows.
I need to work with the Bloomberg ActiveX object. The object allows you to extact data from the Bloomberg market data service.
Refering to the code below. Is there a smarter way to determine if the object returned from the call to blpData.get_BLPSubscribe is an object and what are its dimensions?
Many thanks for your help
KD
import blpdata.*;
public class QuickblpData {
public static void main(java.lang.String[] args) {
blpdata.BlpData blpData;
String bbTicker;
String[] aFields;
String reqField, tmpString ;
Object overrideFields;
Object overrides;
String[] aResults;
Object monitor;
Class objType;
Object[] aObj, aObjd2 ;
try {
//System.loadLibrary("bridge2java");
com.ibm.bridge2java.OleEnvironment.Initialize();
System.out.println("hello");
blpData = new blpdata.BlpData();
bbTicker = "RHAT.US Equity";
int cookie = 1;
aFields = new String[] {"Name", "Company_Tel_Number"};
reqField = "Name";
overrideFields = null;
overrides = null;
aResults = new String[] { " Name " } ; //new Object();
//monitor = new Object();
blpData.set_SubscriptionMode( _FIRE_EVENT_TYPES.ByRequest );
//blpData.Subscribe( bbTicker, cookie , reqField, overrideFields, overrides, aResults );
Object objResults = blpData.get_BLPSubscribe( bbTicker, reqField );
System.out.println( objResults );
objType = objResults.getClass();
System.out.println( objType.getName() );
if ( objResults instanceof Object ) {
if ( objResults instanceof Object[] ) {
System.out.println( "it is Object[]" );
aObj = (Object[]) objResults ;
System.out.println( aObj.length );
if (aObj[0] instanceof Object[] ) {
System.out.println( "aObh[0] is Object[]" );
aObjd2 = (Object[]) aObj[0] ;
System.out.println( aObjd2.length );
tmpString = (String) aObjd2[0];
System.out.println( tmpString );
}
}
}
} //try
catch (com.ibm.bridge2java.ComException e)
{
System.out.println( "COM Exception:" );
System.out.println( Long.toHexString((e.getHResult())) );
System.out.println( e.getMessage() );
}
catch (Exception e)
{
System.err.println( e );
System.out.println("message: " + e.getMessage());
}
}
}