Re: How to tie
- From: Abble <grg2@xxxxxxxxxxx>
- Date: Mon, 31 Dec 2007 07:49:35 -0800 (PST)
On Dec 31, 9:32 am, Lew <l...@xxxxxxxxxxxxx> wrote:
Christian wrote:
Abble schrieb:
I'd like to tie a Java array to some code so when the array is
accessed my code gets run.
Is there some simple way to do this in Java?
Rather not ..
but when you use Collections instead of an array doing this becomes
rather easy.
Give us an example, Christian, or a description of how.
To the OP: You want to wrap access to your protected resource (array,
whatever) in an object that either performs the desired action on access, or
sends a notification to a listener to trigger such action.
JavaBeans have a mechanism available for notifications of property changes and
such events. You can use this to fire an event on each access of interest.
--
Lew
Thanks, Lew, but I'd like if possible to not have to wrap my array.
Here's another angle to the question: Can I dynamically declare new
array names, for instance, if I have a function that opens up a
database, can that function look up the names of the fields in the
database and make similar variables "appear"?
Something like:
OpenDB( "mydb.xyz" ); //mydb.xyz has in it a definition of arrays
A,B, C
// now at this point arrays A B C spring into existence and
populated.
D[i] = A[ i ] + B[i] + C[ i ]; // use A B c
Thanks,
.
- Follow-Ups:
- Re: How to tie
- From: Lew
- Re: How to tie
- References:
- How to tie
- From: Abble
- Re: How to tie
- From: Christian
- Re: How to tie
- From: Lew
- How to tie
- Prev by Date: Re: problem upgrading to JSTL 1.2
- Next by Date: Re: the MI 5 spammer
- Previous by thread: Re: How to tie
- Next by thread: Re: How to tie
- Index(es):
Relevant Pages
|