Re: [tcljava-user] java::cast issue.
Brought to you by:
mdejong
From: <PFi...@hb...> - 2005-10-28 03:11:22
|
My java skills are a bit basic but I did try something like that. Here is a line by line comparison. JAVA: Set s = adminClient.queryNames(queryName, null); JACL: set s [ $AdminClientI queryNames $ObjectNameI $nullI ] The "s" object needs to implement the iterator interface to loop through the array. JAVA: nodeAgent = (ObjectName)s.iterator().next(); JACL: set nodeAgent [ $mbeanList iterator next ] The JACL statement does not cast to ObjectName as I want to keep this simple. The JACL statement fails because the "s" object returned by the query does not implement the iterator interface where as the "s" object returned by the JAVA statement does. "can't find accessible method "iterator" with 1 argument(s) for class "java.util. Set"" Of course now that I have read the javadoc more closely I can see that the problem occurs because an iterator object needs to be instanciated. The JACL code should look like this. set mBeanList [ $AdminClientI queryNames $ObjectNameI $nullI ] set iteratorI [ $mBeanList iterator ] set yy [ $iteratorI next ] set askTedPortalMBeanI [ java::cast ObjectName $yy ] Thanks for your help. Patrick. =================================================== HBF Health Funds Inc. a registered organisation under the National Health Act HBF Insurance Pty Ltd ACN 009 268 277 This email is a confidential communication intended only for the named Addressee(s). If you are not that person any disclosure, copying, distribution or use of this email or the information in it is prohibited. Please notify us immediately by telephone, (+61) 08 9265 6111 or return email and delete this email. The views in this email may be personal to the author and not those of HBF. |