• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Struts2 + Spring + static method - best practices

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

In my application I have:
FileParser interface with one method:HashSet<WordDescription> readWordsList(File file);
Strust2 Action class: FileUploadAction which has fileParser property.

In general I don't need instance of FileParser - readWordsList method can be static but I can't do it in interface. I set the method abstract and injected some implementation of FileParser to FileUploadAction as singleton.

Do you think its good solution? I'm not sure and I'm looking for something better. Have you got any ideas?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keeping implementation details non-specific helps testing and increases extensibility. Not sure what would be better, if anything.
 
Marcin noway
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Keeping implementation details non-specific helps testing and increases extensibility. Not sure what would be better, if anything.



Great to hear it :) Thank you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic