Re: [Asterisk-java-users] MeetMeJoinEvent
Brought to you by:
srt
From: Miked <mi...@si...> - 2007-08-10 03:05:05
|
OK ... I know you were all waiting for me to 'get it' on my own... stupid syntax crap :-) This works! if (event instanceof MeetMeJoinEvent) { System.out.println(((MeetMeJoinEvent)event).getMeetMe()); } THANKS!!! ----- Original Message ----- From: "Miked" <mi...@si...> To: "Carlos G Mendioroz" <tr...@ac...>; <ast...@li...> Sent: Thursday, August 09, 2007 9:09 PM Subject: Re: [Asterisk-java-users] MeetMeJoinEvent > OK Java casting got that ...google is my friend ;-) after thinking I > understood and applying the suggested code ... Eclipse flags error on the > last line 'event.getMeetMe()' "The Method getMeetMe() is undefined for > the > type ManagerEvent" However what does work is as follows: > > This works: > if (event.getClass().equals(MeetMeJoinEvent.class)) { > > MeetMeJoinEvent mmje=(MeetMeJoinEvent)event; > > System.out.println(mmje.getMeetMe()); > > } > > > > Code flaged with error "undefined for type ManagerEvent": > > if (event instanceof MeetMeJoinEvent) { > System.out.println((MeetMeJoinEvent)event.getMeetMe()); } > > > > Not sure why??? Maybe this is Java 101 stuff, but just trying to > understand > ..it would seems these bits of code are the same???.... Help is GREATLY > APPRECIATED! > > ----- Original Message ----- > From: "Carlos G Mendioroz" <tr...@ac...> > To: <ast...@li...> > Cc: <mi...@si...> > Sent: Thursday, August 09, 2007 5:40 AM > Subject: Re: [Asterisk-java-users] MeetMeJoinEvent > > >> Oops, typo :) >> This should go into a FAQ. >> >> Events returned via onManagerEvent come with a common type of Event. >> Depending on the current event, more functionality is available via >> subclasses (of which the actual event "is a"). >> >> Usually you access subclass functionality by casting to the subclass, >> guarded by a type check like: >> >> public void onManagerEvent(ManagerEvent event) >> { >> // just print received events >> System.out.println(event); >> >> if (event.getClass().equals(MeetMeJoinEvent.class)) { >> System.out.println((MeetMeJoinEvent)event.getMeetMe()); >> ... >> >> HTH. >> >> Stefan Reuter @ 09/08/2007 05:18 -0300 dixit: >>> try this: (and take a look at some java introduction ;) >>> >>> public void onManagerEvent(ManagerEvent event) >>> { >>> // just print received events >>> System.out.println(event); >>> >>> System.out.println((MeetMeJoinEvent) mmje.getMeetMe()); >>> } >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Splunk Inc. >>> Still grepping through log files to find problems? Stop. >>> Now Search log events and configuration files using AJAX and a browser. >>> Download your FREE copy of Splunk now >> http://get.splunk.com/ >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Asterisk-java-users mailing list >>> Ast...@li... >>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> >> -- >> Carlos G Mendioroz <tr...@ac...> >> >> >> -- >> No virus found in this incoming message. >> Checked by AVG Free Edition. >> Version: 7.5.476 / Virus Database: 269.11.10/943 - Release Date: 8/8/2007 >> 5:38 PM >> >> > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.476 / Virus Database: 269.11.10/943 - Release Date: 8/8/2007 > 5:38 PM > > |