figleaf-developer Mailing List for Figleaf (Page 4)
Status: Alpha
Brought to you by:
steckman
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(78) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Greg S. <ste...@on...> - 2004-07-01 22:58:38
|
The proxy should intercept all method calls. Then for those that are on
a method of interest, for example those for which there is a
PropertyDescriptor, the proxy will perform some special behavior. Such
as firing events. For all the rest, it just invokes the method on the
underlying object. I think it would be better to use the
PropertyDescriptor rather than the Property you wrote, because it allows
you to access the read and write methods for the property directly, so
you can check if they are being called in your interceptor.
The code would look something like:
public Object intercept(Object o, Method method, Object[] args,
MethodProxy methodProxy) throws Throwable {
PropertyDescriptor[] pd=
((Informative)o).getClassDescriptor().getPropertyDescriptors();
for(int i=0; i<pd.length; i++){
if(method==pd[i].getReadMethod(){
//invoke method here...
//...do what the proxy wants
//...or invoke method here
return;
}else if(method==pd[i].getWriteMethod(){
//invoke method here...
//...do what the proxy wants
//...or invoke method here
return;
}
}
//the method invoked was not for a property
method.invoke(o, args);
}
Greg
sam...@ma... wrote:
>OK, I have made a bit of a mistake with the current code. Firstly I've confused
>the notion of defining what properties there are with how they are invoked. This
>is a problem in that it gives the developer power over how get/set are
>implemented under the hood, thereby eliminating the possibility for me to make
>sure I intercept all property calls and fire the relevent change events. With
>that in mind I'm going to change Property to define one method, getName (read
>only etc can wait for a bit). I'll then create a seperate class capable of
>taking an object and executing the properties.
>
>sam
>
>
>
>
|
|
From: Greg S. <ste...@on...> - 2004-07-01 22:42:46
|
Note that Informative extends Observable. So if you implement Informative, then it means you must also implement Observable. Also, not all methods will be called via Property objects. Consider those objects invoking methods directly on the object (that is, those that know nothing about the Informative interface). Greg sam...@ma... wrote: >Im in the middle of the changes to the proxy creation. When I've finished the >ProxyFactory will be creating objects that implement both Informative and >Observable. Its actually gotten a little complicated and doesn't need to be - I >got a little caught up with making the proxies still implement the same >interface as the original developer-defined domain objects which of course they >don't need to be - all methods will be called via Property objects obtained from >the Infromative implementation. The rewrite is fairly hairy - not sure I'll >finish it tonight. > >Oh, and please respond to let me know you're getting this! > >sam >http://www.magpiebrain.com/ > > > >------------------------------------------------------- >This SF.Net email sponsored by Black Hat Briefings & Training. >Attend Black Hat Briefings & Training, Las Vegas July 24-29 - >digital self defense, top technical experts, no vendor pitches, >unmatched networking opportunities. Visit www.blackhat.com >_______________________________________________ >Figleaf-developer mailing list >Fig...@li... >https://lists.sourceforge.net/lists/listinfo/figleaf-developer > > |
|
From: <sam...@ma...> - 2004-07-01 21:52:32
|
OK, I have made a bit of a mistake with the current code. Firstly I've confused the notion of defining what properties there are with how they are invoked. This is a problem in that it gives the developer power over how get/set are implemented under the hood, thereby eliminating the possibility for me to make sure I intercept all property calls and fire the relevent change events. With that in mind I'm going to change Property to define one method, getName (read only etc can wait for a bit). I'll then create a seperate class capable of taking an object and executing the properties. sam |
|
From: <sam...@ma...> - 2004-07-01 21:39:10
|
Im in the middle of the changes to the proxy creation. When I've finished the ProxyFactory will be creating objects that implement both Informative and Observable. Its actually gotten a little complicated and doesn't need to be - I got a little caught up with making the proxies still implement the same interface as the original developer-defined domain objects which of course they don't need to be - all methods will be called via Property objects obtained from the Infromative implementation. The rewrite is fairly hairy - not sure I'll finish it tonight. Oh, and please respond to let me know you're getting this! sam http://www.magpiebrain.com/ |