![]() |
|
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. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
java contructor parameters
When writing a java class to be called from Sage, what parameters are used in the invocation of the class that would be used for the constructor?
I would like for the class to load some data to cache to be used by later method calls... Thanks, Jeff |
#2
|
||||
|
||||
The syntax is new_package_Class(args), per p. 151 of the Studio manual.
__________________
-- Greg |
#3
|
|||
|
|||
Thanks, that did it, plus I didn't have the contructor declared as public which caused it not to work...
One question on how the studio manual shows how to use it. When you create a new instance of the class, and call the method with has the newly created object as the first argument, do you need to setup a method in the class to call the method within the object that is passed... I know that sounds a bit confusing... For example in sudo code: Sage Define new instance: X = new_package_class(); Sage Method call: package_class_method(X,args) Java: class class { method(args) { some code return value } method(Object o,args) { return o.method(args) } } I was originally testing without using the object passed into the java class and it seem to always use the last object created.... Sorry if this sounds convoluted... Thanks, Jeff |
#4
|
||||
|
||||
Assuming the following sample java....
Code:
package test.sage; public class Foo { public Foo() { } public String hello(String name) { return "Hello " + name; } } FooInstance=new_test_sage_Foo() Text=test_sage_Foo_hello(FooInstance, "world") So, you can use existing java objects as is... ie, File=new_java_io_File("myfile.jpg") Exists=java_io_File_exists(File) Hope that makes sense.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#5
|
|||
|
|||
I thought that is what I was doing. I had a method that had no args, and when I called it like you have it in your example, I was getting a java exception. When I added an (Object o) as the argument and basically ignored o in the code, the call worked. I will test it when I get home with your sample snippet, maybe I had another issue at the same time and was chasing a red hearing...
Thanks, Jeff |
#6
|
|||
|
|||
Thanks for your help Greg/Sean... Turned out to be a problem with my public/static on the methods..
Some reason, Eclipse suggested I put the static in while doing some testing, and after some cutting and pasting, it ended up all over... ![]() Once I got them all straight, it is working like a charm... Thanks again, Jeff |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Screen Saver parameters for Slideshow | Zorglub | SageTV Beta Test Software | 1 | 10-19-2006 08:15 PM |
Extender Transcoding - property parameters? | Mahoney | SageTV Media Extender | 18 | 08-31-2006 02:57 PM |
CVD parameters | CBenvie | SageTV Software | 2 | 01-02-2005 10:23 PM |
Command line parameters? | Opus4 | SageTV Software | 1 | 04-03-2004 03:44 AM |
are there any brightness parameters for the UI? | GbrNole | SageTV Beta Test Software | 2 | 01-28-2004 02:57 PM |