Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java design pattern issue

 
j-learner kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
j-learner kumar wrote:and also can have dynamic arguments


I will use var-args for this, example:
 
j-learner kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
interface:

implementing classes:


invokation:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic