object reference

a function getId() return me an Object type that represent the address or pointer to a String value.How can i retrieve the String value from the Object?String representation of Object is:Location: obj: xml.modify.impl.ClipImpl@996ccaPlease help me!!
[284 byte] By [Nil_2004] at [2007-9-30 19:04:09]
# 1

I'm not entirely sure I understand what you're trying to do...

do you just want to cast the Object to a String?

String theValue = (String)getId();

or is something else required?

if you post a brief code sample so that we can see more easily what you're trying to accomplish, then maybe we can help you.

T

chez_mo at 2007-7-6 23:13:44 > top of Java-index,Administration Tools,Sun Connection...
# 2
I have not understand your question properly but as you want to get Sting from the Object , for that you have to simply used toString for the Object.String strResult=getId().toString();I think this may help you. or not can you pass me small code discribing what you
softclimax at 2007-7-6 23:13:44 > top of Java-index,Administration Tools,Sun Connection...
# 3

I try in both mode:

- if I use Cast ( (String) obj.getId() ) i recieve a java.lang.ClassCast Exception;

- if I use toString() method, the strResult is the index (in memory I presume) of the value, but not the true value.

I use JAXB, but I think this problem is related standard JAVA library.

The code:

-

public void gestisci_slave(SlaveType slave,List module){

ObjectType obj;

String s;

List elemento;

obj=slave.getObject();

s= obj.getId().toString();

System.out.println("ID= "+s);

}

-

where:

- ObjectType and SlaveType are types generated by JAXB;

- slave.getObject() return me an ObjectType type;

- obj.getId() return me an Object type (java.lang.Object);

If I execut code, the s output is:

ID= xml.modify.impl.ClipImpl@82d210

xml.modify.impl.ClipImpl identify a class generated by JAXB, @82d210 is (I presume) memory address.

How can I get the true value?

I try with Reference and RefAddr type, but.....nothing!!!!

Any idea?

PS: in JAXB documentation there is Reference type link, but the html file is empty!!

Nil_2004 at 2007-7-6 23:13:44 > top of Java-index,Administration Tools,Sun Connection...
# 4

You can't get the string representation in the format you want. because the SlaveType class doesn't seems to override the toString() method. It is encapsulated in that way. You must encapsulate a method to achive it. Otherwise you will get the output as xml.modify.impl.ClipImpl@xxxxx only.

(Dhananjay Singh)

jaypro781 at 2007-7-6 23:13:44 > top of Java-index,Administration Tools,Sun Connection...