This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

101 Q, verification on simple issue: objects in package

 
Edmund Castermund
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This is one of the super basic newb q's I shouldn't need to ask, but..
Just need to verify two things:

1) there's no way to create a method that will return any object from a package, as in:


and 2) it's bad design to create an abstract superclass with no methods or properties so that you can do the above?

I'm just not crazy about


what are the best ways to deal with that issue?
thanks!
ec
 
Rob Spoor
Sheriff
Pie
Posts: 20380
45
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to do something like this? You get just any object, but you can't do anything with it. The least you should do is use a common interface. You can then perhaps use the ServiceLoader mechanism to return a number of implementations.
 
Edmund Castermund
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the immediate task is to read an xml file and create objects...I suppose I can create an arraylist of the top level objects and test each interface, as you say.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic