Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

getOrigin() target class unclear

When working with the RTC Plain Java Client API it is very often the case to get from a specific Item implementation to its corresponding project area resp. repository.

For that the method IItemHandle.getOrigin() is used (a few times to get to the right layer).

The problem here is that you never know what class you get after calling getOrigin() since the return type is Object.

Is there any overview or best practice on how to identify what the result of the method is?
Using the debugger to find it out is not really efficient.

Thank you

0 votes


Accepted answer

Permanent link
getOrigin() returns the ITeamRepository (at least in the client API). Please see: https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ .

If you have set up your environment as mentioned in that (and the related posts) you can also see what the class is that gets returned during debugging.

Be aware that the classes are often show something like SomeClassImpl which is usually not the class you want to work with. there is always an interface ISomeClass, which you want to cast to and that you actually want to use. This prevents you from being dependent from the internal implementation classes and stay with the more robust API interface.
Marko Tomljenovic selected this answer as the correct answer

1 vote

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,930

Question asked: Nov 10 '15, 5:28 a.m.

Question was seen: 1,652 times

Last updated: Nov 10 '15, 6:55 a.m.

Confirmation Cancel Confirm