What you are looking for is a type-safe enum. One of the interesting things about this, is that a set of String statics is not typesafe to begin with. You can pass any manual string you want. On a java programming note, I would checkout the Enum and ValuedEnum classes over at the Jakarta Commons Lang package.
However, since you do not have control over the client side, you will never really be able to restrict what values they pass. You can "suggest it". But that in itself is totally separate from the JavaBean construct. JavaBeans (and the JDK proper) has no real type-safe enum construct (hence the reference to Jakara Commons above). What you are looking to do would be accomplished just as effectively as passing an array of Strings from a method. String[] getNames() You cannot ensure type-safety on the client side with a SOAP message, so the method above is no worse than any other I can think of. The enumeration would have to be created on the client side again anyway. Trying to mesh SOAP with your String statics is kinda like fitting a square peg into a round hole. You may be better off with a simple structure like above. This way, you can change the valid choices w/o breaking your WSDL or exported API. Having to change your WSDL when you added choices would make for a brittle application. IMO. Ben On Thu, 2003-02-06 at 18:23, Liviu Chiriac wrote: > Yes, you explained it right. > > -----Original Message----- > From: Pathak, Sanjesh [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 06, 2003 5:41 PM > To: [EMAIL PROTECTED] > Subject: RE: how to serialize/deserialize static final fields > > > It is an interesting topic. Although I am not an expert on WSDL or > BeanSerializer, I think I understand your point. If BeanSerializer does > not serialize constants, then there is no way a client can get that > information. The information or value of the constant has to be either > in WSDL or in the serialized data. If it is not there at both the > places, then their is no way a client can get that information. May be > you might have to re-design your code like sending this information in > the header and asking the client to send it's choice back as a header or > add an extra parameter to your service so as to pass that value. > > Sanjesh > > > -----Original Message----- > From: Liviu Chiriac [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 06, 2003 4:31 PM > To: 'Mike Burati'; [EMAIL PROTECTED] > Subject: RE: how to serialize/deserialize static final fields > > > I understand, by design is not possible. Or at least it is not possible > with a BeanSerializer/Deserializer. > > But what I want to do is not contradictory: I want a user to pick a > value out of 3 that I have pre-defined (as constants in my class). I > need a way to communicate to the client what those pre-defined values > are. When the client sends an object to the server, I check to see which > value he picked (out of these 3) and perform different tasks > accordingly. (But I need him to pick only one of these 3...) > > What is the best way to transmit these static constants (associated with > a particular class), to the user, if I cannot do it with a > BeanSerializer/Deserializer? > > > Liviu > > >