Cast String to String
Hi - I am working with a package that has implemented its own String Class. Consequently I am always finding that I need to convert from java.lang.String to soap.pkgname.String. The way I have been doing it so far is by looping manually through all the contents of the xxx.String using .split. But I am sure there must be an easier way using casting.
Can someone please publish an example of how to cast java.lang.String to soap.pkgname.String and visa versa.
I strongly doubt you can cast one to the other. String can't be extended so their String class can't be a child class of String, so this makes no sense.
You won't be able to cast as Fubarable clearly explained. Never seen the soap.pckgname.String class, but if it represents a String as the java.lang.String class then it should be easy to convert between the two by studying the API's.
Thanks Guys. The API I was referring to was TripWire. Its only available as compiled code so its kind of hard for me to walk through it and in doing so I really dont learn any more than I can from the IDE prompts. And none of the methods listed have a name that implies casting or converting from one type to another. Guess I will just have to continue to do it with a manual loop:
Moderator Edit: Quote tags changed to Code tags
fListOfNodeFields = getAllSvcFieldContents(sListOfNodeOrServiceFields,issue);
com.javahollic.tripwire.soap.tripwire.String tNodeList = new com.javahollic.tripwire.soap.tripwire.String[fListOfNodeFields.size()];
int idx = 0;
for (Iterator i = fListOfNodeFields.iterator(); i.hasNext();)
tName = i.next().toString();
if ( !tName.equals("") )
tNodeList[idx++] = new com.javahollic.tripwire.soap.tripwire.String( tName );
Regardless of whether you have source code or not, have you had a chance to look at the tripwire API? As doWhile notes above, likely all your answers are to be found there. Also, you'll not want to use quote tags in your posts for code but instead should use code tags. I've made the changes in your post above.
Ah - thanks much Fubarable... I was looking for the label that left my code indented.
I thought I had thoroughly looked at all of the API docs... I have been working on this project for quite a while and am fairly sure that I have copied all available material. I will certainly look again to see what I can find.
Who on earth thinks it's a good idea to create your own String class?
"I've got this new class that holds characters."
"What's should we call it?"
"How about String?"
"Yeah, what could possibly go wrong with that name?"