[cdi-dev] Vetoed with Expression

Martin Kouba mkouba at redhat.com
Tue Feb 24 09:38:38 EST 2015


Hi Otávio,

I'm not sure if it makes sense without the notion of ProjectStage and 
config properties. We could probably extend @Vetoed with something 
similar to exclude filters [1].

Just out of curiosity - how would PaymentInterpreter evaluate "instance 
eq mexico"? I mean what is 'instance' resolved to and how?

Martin

[1]
http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#exclude_filters


Dne 20.2.2015 v 22:23 Otávio Gonçalves de Santana napsal(a):
> In CDI we have the Vetoed annotation[1] that vetoes the class, but we
> can't use expression to represent exclude this class.  This feature
> would useful to many things, for example, an internationalization of
> payment[2] or just have a class that should not run when is in
> production. In Delta Spike[3], already there are this improvement.
>
>
> [1]http://docs.jboss.org/cdi/api/1.2/javax/enterprise/inject/Vetoed.html
> [2]
>
> public interface Payment {
> void pay();
> }
>
> @Vetoed(onExpression = "instance eq brazil", interpretedBy =
> PaymentInterpreter.class)
> class BrazilianPayment implements Payment {
> ...
> }
>
> @Vetoed(onExpression = "instance eq mexico", interpretedBy =
> PaymentInterpreter.class)
> class MexicanPayment implements Payment {
> ...
> }
> [3]https://deltaspike.apache.org/documentation/core.html#__exclude
>
> --
>
> Otávio Gonçalves de Santana
>
> twitter: http://twitter.com/otaviojava
> site: _http://about.me/otaviojava_
> 55 (11) 98255-3513
>
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>

-- 
Martin Kouba
Software Engineer
Red Hat, Czech Republic


More information about the cdi-dev mailing list