aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Java design pattern issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java design pattern issue" Watch "Java design pattern issue" New topic
Author

Java design pattern issue

j-learner kumar
Greenhorn

Joined: Jun 15, 2012
Posts: 2
Hi,

I am designing one java scenario, need to know weather It would be applicable to implement any design pattern or normal java class will do and the details are

there are 3 method operations on files like

copyOperation(source, destination)
moveOperation(source,destination)
deleteOperation(source)

for the above three methods looks closely related to different kind of operations. My question is, would it be possible to have any java design pattern thru which I can have only one method in interface (in place of above three e.g. opertaions(arg1,arg2...) ) and also can have dynamic arguments i.e. I can increase or decrease the number of arguments while overriding above methods in the implementing class.

can someone please suggest which design pattern can satisfy the above scenario


Thanks in advance

Myyron Murray Latorilla
Ranch Hand

Joined: Dec 10, 2009
Posts: 65

j-learner kumar wrote:and also can have dynamic arguments


I will use var-args for this, example:


OCPJP6
j-learner kumar
Greenhorn

Joined: Jun 15, 2012
Posts: 2
myyron latorilla wrote:
j-learner kumar wrote:and also can have dynamic arguments


I will use var-args for this, example:



if possible, how to use var- args in interface and achive polymorphism.

Do we have any design pattern for this scenario... if yes , which is suitable to implement...

like I want one common interface called "MyOperations" and three classes will implement the Operations(String source,String dest)

by this way I want to achieve polymorphism, is this possible..


Thanks in advance
Myyron Murray Latorilla
Ranch Hand

Joined: Dec 10, 2009
Posts: 65

interface:

implementing classes:


invokation:
 
Don't get me started about those stupid light bulbs.
 
subject: Java design pattern issue