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
Accepted answer
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.
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.