• Post Reply Bookmark Topic Watch Topic
  • New Topic

workaround for fully qualified class names?  RSS feed

 
Bala Gangadhar
Ranch Hand
Posts: 119
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have two classes with same name in different packages.
So in order to use both the class in class, either of the two classes has to be used with its fully qualified name.
Since the package name is too big and classes are used at many places, the readability of the code is effected.
Is there any workaround for this (some thing like aliases.. ?)

Thanks in advance..
Bala.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, there is no work-around.

you declare one class in the import statement and other class[where ever the class get used] using fully qualified name[with package]
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on the nature of the classes in question, you might just be able to subclass one or both and use those instead... but it depends.
 
tushar bhasme
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bala Gangadhar wrote:Hi All,

I have two classes with same name in different packages.
So in order to use both the class in class, either of the two classes has to be used with its fully qualified name.
Since the package name is too big and classes are used at many places, the readability of the code is effected.
Is there any workaround for this (some thing like aliases.. ?)

Thanks in advance..
Bala.


You don't have to import both the classes, or use fully qualified names for both... just import one, while use a fully qualified name for the other... thats 1 possible sol...
 
Bala Gangadhar
Ranch Hand
Posts: 119
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have to import both the classes, or use fully qualified names for both... just import one, while use a fully qualified name for the other... thats 1 possible sol...


Anyway we can't import both the classes...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!