• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java design pattern issue

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 65
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
interface:

implementing classes:


invokation:
 
reply
    Bookmark Topic Watch Topic
  • New Topic