File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generics with methods for specific types

 
Chinababu Illa
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a class and another class

I need a method to retrieve some of the properties of XType and those properties are not available in BaseType. So that this method is not generic for both the types and is specific only to XType. This is the only method which is specific to XType, and rest all are generic methods, which convinced me to have generic class.
Is there any way, such that I can make this method visible only for the and not visible for the

Thanks,
Chinna
 
R. Jain
Ranch Hand
Posts: 375
1
Java Python Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need a different class(Format) at all to do what you need??
You can simply have the methods(which you are calling generic) in your BaseType class and
the methods which are specific to XType will be in that class only..

The problem what you are stating is of Basic Inheritance and Dynamic Binding, rather than of Generics..
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is confusing, which suggests to me your inheritance design is confusing, too. I suspect the best thing to do is go back and look at the hierarchy (as RJ has already suggested) and consider whether XType extends BaseType is the best inheritance to use.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic