aspose file tools*
The moose likes Java in General and the fly likes Passing a parameter to a class outside your control Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Passing a parameter to a class outside your control" Watch "Passing a parameter to a class outside your control" New topic
Author

Passing a parameter to a class outside your control

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Implementors are required to implement an interface, IView.

The container will do a newInstance on contributed implementations; then call createPartControl. In my implementation of IView, I need to use a String value inside createPartControl & this value must be passed in to me via some mechanism. Obviously I'm NOT able to provide another constructor that can accept a parameter.

My initial thought is to use a ThreadLocal. Ideas ?

Thanks
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14433
    
  23

It looks like you're writing an Eclipse plugin...

The information to provide is too vague to give you good advice. Where does this string that you need in createPartControl(...) come from? ThreadLocal is for thread-local storage, i.e. if you need one copy of some data for each thread that uses your implementation of IView. Why do you think that that is what you need? You don't specify anything about multi-threading in the rest of your question.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing a parameter to a class outside your control