[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [aspectj-users] Serialization and Annotations question
- From: "Eric Bodden" <eric.bodden@xxxxxxxxxxxxxx>
- Date: Mon, 27 Nov 2006 09:30:16 -0500
- Delivered-to: email@example.com
- Thread-index: AccSInrEUf8UHYFHRkuEkqi3kSKGKAADbsGQ
- Thread-topic: [aspectj-users] Serialization and Annotations question
> First of all, I'm not sure if attaching to ObjectInput.readObject is
> the best way. I'm doing that because during deserialization the
> constructors are not called so I'm not sure what pointcut to define
I am pretty sure that Java calls the default constructor, actually.
Indeed it's a requirement that any serializable class must have one
(implicitly or explicitly).
> Second, I would prefer to get rid of the check to see if the
> @Configurable annotation is present. It would be nicer if I could do
> something like this:
> pointcut readObject() : call((@Configurable *)
> So let AspectJ only run this aspect when readObject returns an object
> that is annotated with @Configurable. Is something like that possible,
> or does AspectJ not work at runtime, which would be required I guess.
No this you cannot do. At this point you have no static type
information. You only know it's an Object. So there is no way AspectJ
could make any such decisions statically.