|
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
|
||||
|
||||
Studio and enums
Hi,
I am not sure if I am just being dense, but I am having an issue utilizing enums in a project I am working on in studio. Here is the scenario Method I am calling which returns an enum Code:
public HVACMode getHVACMode() Code:
public enum HVACMode { OFF("Off", "Off"), HEAT_ON("HeatOn", "Heat On"), COOL_ON("CoolOn", "Cool On"), AUTO_CHANGE_OVER("AutoChangeOver", "Auto Change Over"), UNKNOWN("Unknown", "Unknown"); private String mode; private String name; private HVACMode(String mode, String name) { this.mode = mode; this.name = name; } public static HVACMode parseMode(String mode) { if(mode.equals(OFF.getMode())) { return OFF; } else if(mode.equals(HEAT_ON.getMode())) { return HEAT_ON; } else if(mode.equals(COOL_ON.getMode())) { return COOL_ON; } else if(mode.equals(AUTO_CHANGE_OVER.getMode())) { return AUTO_CHANGE_OVER; } else { return UNKNOWN; } } public String getMode() { return mode; } public String getName() { return name; } } Code:
IF jvl_vera_devices_Thermostat_getHVACMode(instance) == jvl_vera_devices_Thermostat_HVAVMode_OFF Sage says it does not know what "jvl_vera_devices_Thermostat_HVAVMode_OFF" is. Is this possible. Am I doing something wrong. What do you do if there is an underscore in the name of the enum like "HEAT_OFF"? Any help would be appreciated. Josh |
#2
|
||||
|
||||
I don't think I've seen an enum used in studio - it my simply not be supported. You likely should implement a simpler method that either returns a string, or a series of boolean 'isOff, isOn' etc methods.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#3
|
||||
|
||||
Quote:
Do you know if there is a way to handle method names or variables with an underscore in them? |
#4
|
||||
|
||||
Same... I don't think you can. From what I remember, Sun recommends against using underscores in method and variable names, and recommends using CamelCase for everything.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#5
|
||||
|
||||
Quote:
http://www.oracle.com/technetwork/ja...ns-135099.html Quote:
|
#6
|
||||
|
||||
Right, just remember that Studio is not Java. It utilized Java for it's expressions, but it is not equivalent to java code completely. It you want to run full java code, you compile that into a .jar, and make calls to that from the STV.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#7
|
||||
|
||||
I figured out my issue. Apparently studio somehow handles variables and methods with underscores without issues. It also can handle enums without issues.
Where my issue was I created my enum as a subclass/innerclass of another class. Sage was having issues creating an instance of the enum or referencing methods of the enum in this manner. I moved it out to its own and it works great! So in otherwords I am not sure Studio can handle inner classes, or enums inside a class. This might have been my own stupidity, or possible just a weird reflection issue. Josh |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Working with enums in Studio | tmiranda | SageTV Studio | 2 | 09-04-2010 03:50 PM |
Studio for V7 | bclenney | SageTV Studio | 2 | 07-30-2010 02:57 PM |
any chances of altering the graphics in sage without studio? studio users please read | reboot_this | SageTV Customizations | 1 | 12-03-2004 04:03 AM |