Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-21-2006
nightnday nightnday is offline
Registered User
 
Name: David Chu
Organization: UofH
Project: FlightOp
 
Join Date: Feb 2006
Posts: 6
Java: going from String to Enum Type

In Java:

I have an ice interface that contains enum declarations.

Does ICE generate a class/method where I can convert a String of enum value, so that I can assign the converted value to the member variable of the same enum type?

Currently I have to do it this way
i.e
enum EmployeePaidType { salary, hourly };

EmployeePaidType myEmployeePaidType;
if( "salary".equals(paidType) )
myEmployeePaidType = EmployeePaidType.salary;
else if( "hourly".equals(paidType) )
myEmployeePaidType = EmployeePaidType.hourly;


I am using ICE 3.0.1 on Windows XP
__________________
David Tom
Student at Houston
Data Validator
Reply With Quote
  #2 (permalink)  
Old 03-21-2006
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Hi David,

I'm afraid there isn't a more convenient way to perform this conversion.

Take care,
- Mark
Reply With Quote
  #3 (permalink)  
Old 03-21-2006
nightnday nightnday is offline
Registered User
 
Name: David Chu
Organization: UofH
Project: FlightOp
 
Join Date: Feb 2006
Posts: 6
It would seem that this should be a standard for the generated code.

Also it would be nice to have the size be public accessible by variable or getter.
__________________
David Tom
Student at Houston
Data Validator

Last edited by nightnday : 03-21-2006 at 06:24 PM.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
encoding error when Ice java client get string from Ice c++ server casper Help Center 1 09-16-2005 04:01 AM
How to define a variant type? fengxb Help Center 2 07-31-2005 11:45 AM
problem in mapping string->string[] in C# teayu Help Center 2 10-27-2004 12:12 AM
libpath failure for icepack server type java-icebox Tim Bug Reports 2 06-30-2004 05:40 PM
Type id ganzuoni Comments 5 07-02-2003 04:09 AM


All times are GMT -4. The time now is 10:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.