Re: instanciate an interface - alternatives?
From: Adi Schwarz (adolf.schwarz.news.01-04_at_gmx.at)
Date: 01/30/04
- Next message: Hylander: "Re: Hashcode of primitive types"
- Previous message: Hylander: "Re: Compiling a JSP programmatically"
- In reply to: Ashton: "Re: instanciate an interface - alternatives?"
- Next in thread: Tor Iver Wilhelmsen: "Re: instanciate an interface - alternatives?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Jan 2004 00:04:50 +0100
Ashton wrote:
>
>>I want to write a class that stores and manages certain objects. This
>>objects have to implement an interface called "SelfLoadable", that means
>>they can manage to load their information (from a file, database,
>>internet,...) themselves by providing a key that identifies the object
>>(e.g. primary key).
>
> Here's a theory that I've used in the past and like.
>
> Since a key identifies an object, a key should be able to recreate the
> object if it's not in cache.
Since I want to stay as general as possible (with the cached objects as
well as with the used keys) I do not really like that suggestion - but
it is a very interesting approach.
My solution if you are interested: I have to tell the ObjectCache
instance anyway wich type of Objects it will cache - so I call the
Constructor with
new ObjectCache(new someSpecialKindOfObjectImpelmentingSelfLoadable);
The ObjectCache stores this (blank = unloaded) object as some kind of
pattern, and if it has to create a new obj it just clones this pattern
and calls the load(key) function.
Sometimes it is really good just to take a break and have a meal ...
greets,
-as
- Next message: Hylander: "Re: Hashcode of primitive types"
- Previous message: Hylander: "Re: Compiling a JSP programmatically"
- In reply to: Ashton: "Re: instanciate an interface - alternatives?"
- Next in thread: Tor Iver Wilhelmsen: "Re: instanciate an interface - alternatives?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|