Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » how to get IField java class full name?
how to get IField java class full name? [message #717948] Mon, 22 August 2011 19:34 Go to next message
Leonardo Kenji Shikida is currently offline Leonardo Kenji ShikidaFriend
Messages: 37
Registered: July 2009
Member
Hi

here´s what I am doing

for(IField f:type.getFields()){
  field = f.getElementName();
  fieldType = f.getTypeSignature();
  ...
}


then I try to interprete fieldType using org.eclipse.jdt.core.Signature javadoc.

unfortunately, this isn´t enough to discover if, let´s say, fieldType is java.util.Date or java.sql.Date for example.

Is there any smarter way to get this info?

TIA

Leo K.

[Updated on: Mon, 22 August 2011 19:34]

Report message to a moderator

Re: how to get IField java class full name? [message #718052 is a reply to message #717948] Tue, 23 August 2011 06:27 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
You could call IType#resolveType("Date") to get the resolved type.
Re: how to get IField java class full name? [message #718192 is a reply to message #718052] Tue, 23 August 2011 14:50 Go to previous message
Leonardo Kenji Shikida is currently offline Leonardo Kenji ShikidaFriend
Messages: 37
Registered: July 2009
Member
thanks!

String[][] ss = myField.getDeclaringType().resolveType(fieldType);
String fieldType = ss[0][0]+"."+ss[0][1]; //full path

did the trick!

TIA

Kenji
Previous Topic:rewriting ast with Template Variables (still open)
Next Topic:JUnit 4.9 is out - how can I upgrade JDT
Goto Forum:
  


Current Time: Fri Apr 26 21:28:33 GMT 2024

Powered by FUDForum. Page generated in 0.03251 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top