openwebbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars-Fredrik Smedberg <itsme...@gmail.com>
Subject Re: Question on verifying java classes in a CDI extension
Date Sun, 13 Jul 2014 06:12:47 GMT
@Mark

Thanks for the solution, I guess that would work regardless of the
underlying proxy technique as well.

The "problem" with solution is that I need to traverse the Set and I cannot
do a simple set.contains(...), which might not be a big problem since if I
get a match I could insert the proxy class in the set as well I guess...





On Sat, Jul 12, 2014 at 10:48 PM, Mark Struberg <struberg@yahoo.de> wrote:

> maybe it's possible to use Class.isAssignableFrom?
>
> Because a proxy for the
> publuc class MyCustomer
>
> is basically simply a subclass
> public class MyCustomer$$Proxy extends MyCustomer
>
> LieGrue,
> strub
>
>
>   On Saturday, 12 July 2014, 20:52, Lars-Fredrik Smedberg <
> itsmeden@gmail.com> wrote:
>
>
>
> Hi!
>
> I have the following scenario:
>
> 1. A CDI extensions verifies all AnnotatedTypes (in @Observes
> ProcessAnnotatedType) that is annotated with a specific annotation
> 2. The class (from annotatedType.getJavaClass()) is verified according to
> some application specific rules...
> 3. If the class has been successfully verified its placed in a
> Set<Class<?>> that is a member variable of the CDI extension
> 4. The extension is injected into another bean and when the application is
> running I would like to check if a specific object has a type that is
> amongst the correctly verified types in the Set
>
> The above works fine if the object to check is an object created by new or
> if its an injected dependent object. However if the object is a normal
> scoped object the class of the object will
> not match any of the classes in the Set because it will be the proxy class
> and not the proxied class (which is the one verified and put in the Set in
> the CDI extension).
>
> Is there any other way of doing the above or can I somehow get the proxied
> class so I can check if its in the Set?
>
> Regards
> Lars-Fredrik
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.
>
>
>


-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Mime
View raw message