SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-07-2005, 01:47 AM
lotus298 lotus298 is offline
Sage User
 
Join Date: Jun 2005
Posts: 17
Studio API question

This is more of a Java question than an API question. In the following code snippet, I am calling an API function that should return a boolean value. Unfortunately, I'm not sure how to cast the returned object to a boolean. Does anyone know how to do this?

thanks.

Code:
public static boolean DeleteFile(Object mediafile)
throws InvocationTargetException {
    try {
        Object obj = SageTV.api("DeleteFile", mediafile);
        <how do i cast obj to boolean so I can return it?>
        return <the new boolean value>;
    } catch (InvocationTargetException ite) {
        throw new InvocationTargetException(ite,"Exception caught");
    }
}
Reply With Quote
  #2  
Old 12-07-2005, 04:24 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Quote:
Originally Posted by lotus298
This is more of a Java question than an API question. In the following code snippet, I am calling an API function that should return a boolean value. Unfortunately, I'm not sure how to cast the returned object to a boolean. Does anyone know how to do this?
SageAPIs always return objects, so you if you want the native type, you need to convert them to the correct Object wrapper, then use the function to retrieve the native type...

Check out my SageTV.api() wrappers in the nielm_sageutils.jar package (source in CVS) specifically the booleanApi function...

The Object return value is cast to a Boolean object, then Boolean.booleanvalue() is used to return the real boolean value...

(This is also how it is done for Long, Integer, Float, Double etc etc)
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #3  
Old 12-07-2005, 01:01 PM
lotus298 lotus298 is offline
Sage User
 
Join Date: Jun 2005
Posts: 17
I'll check that out. Thanks for the help.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 06:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.