Zha*_*g18 3 java bloomberg data-structures
我有Element类的数据.我正在尝试将其值写入文件,但我遇到了麻烦:
< Some process to acquire values into the variable "fieldData" >
// Prepare file output
FileWriter fstream = new FileWriter("C:/output.txt");
BufferedWriter out = new BufferedWriter(fstream);
Element field = fieldData.getElement(i);
out.write(field); // DOESN'T WORK: The method write(int) in the type BufferedWriter is not applicable for the arguments (Element)
out.write(field.getValueAsString()); // DOESN'T WORK: Cannot convert SEQUENCE to String
Run Code Online (Sandbox Code Playgroud)
关于我应该如何处理这个案子的任何建议?另外,对于我来说,看到(即打印到屏幕)可用的静态变量和与对象相关的方法的最佳方法是什么?谢谢.
更多代码片段以帮助调试:
private static final Name SECURITY_DATA = new Name("securityData");
private static final Name FIELD_DATA = new Name("fieldData");
Element securityDataArray = msg.getElement(SECURITY_DATA); // msg is a Bloomberg desktop API object
Element securityData = securityDataArray.getValueAsElement(0);
Element fieldData = securityData.getElement(FIELD_DATA);
Element field = fieldData.getElement(0)
out.write(field); // DOESN'T WORK: The method write(int) in the type BufferedWriter is not applicable for the arguments (Element)
out.write(field.getValueAsString()); // DOESN'T WORK: Cannot convert SEQUENCE to String
Run Code Online (Sandbox Code Playgroud)
事实证明,这个Bloomberg Prop数据结构至少可以说是啰嗦:
private static final Name SECURITY_DATA = new Name("securityData");
private static final Name FIELD_DATA = new Name("fieldData");
Element securityDataArray = msg.getElement(SECURITY_DATA); // msg is a Bloomberg desktop API object
Element securityData = securityDataArray.getValueAsElement(0);
Element fieldData = securityData.getElement(FIELD_DATA);
Element field = fieldData.getElement(0);
/* the above codes were known at the time of the question */
/* below is what I was shown by a bloomberg representative */
Element bulkElement = field.getValueAsElement(0);
Element elem = bulkElement.getElement(0);
out.write(elem.name() + "\t" + elem.getValueAsString() + "\n");
Run Code Online (Sandbox Code Playgroud)
哇...我不认为他们试图让事情变得简单!我也很好奇是否有一种方法可以通过让Java打印出正确的方法来追踪数据结构来解决这个问题?
| 归档时间: |
|
| 查看次数: |
2107 次 |
| 最近记录: |