Re: How to tie



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
.



Relevant Pages

  • Re: How to tie
    ... You want to wrap access to your protected resource (array, ... whatever) in an object that either performs the desired action on access, ... sends a notification to a listener to trigger such action. ... database, can that function look up the names of the fields in the ...
    (comp.lang.java.programmer)
  • Re: Java Generic programming using subclassing
    ... Java nowhere guarantees that the elements of an array ... Now chances are that any Java ... > reference will be visible through the other. ... > eligible for garbage collection, and will in fact be collected before ...
    (comp.lang.java.programmer)
  • Re: java based supercomputer
    ... checking the correlation beteween an array of data and another array ... java psuedo remote threads will take a considerrably less time. ... Does your algorithm lend itself well to paralellization? ... the only bottleneck i can see is checking the correlation value ...
    (comp.lang.java.programmer)
  • Re: How to store a large amount of 3D data points in Java?
    ... >>None of which would be a problem if you could store ints in a Java ... > With 1.5 autoboxing you can, even if it is implemented with objects. ... ArrayList does array copy for resizing. ...
    (comp.lang.java.programmer)
  • Re: MinMax aus Integer-Array schnell ermitteln
    ... Trick "Loop unrolling" erreicht. ... Java sollte eigentlich an Delphi rankommen, ... Array UP ... private static void fillArray0() ...
    (de.comp.lang.java)