[seam-dev] First cab off the rank!

Shane Bryzak sbryzak at redhat.com
Tue Dec 1 18:53:44 EST 2009


Remoting now has full support for looking up qualified beans, so you can 
now do cool stuff like this:

<script type="text/javascript">
     function sayHello() {
       var name = prompt("What is your name?");
       if (name == null) return;
       var callback = function(result) { alert(result); };
       
Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction", 

          "@HelloQualifier(foo = 123, bar = 
String.class)").sayHello(name, callback);
     }
</script>


@Retention(RUNTIME)
@Target(TYPE)
@Qualifier
public @interface HelloQualifier {
    int foo();
    Class bar();
}

@HelloQualifier(foo = 123, bar = String.class)
public class HelloAction {
   @WebRemote
   public String sayHello(String name) {
     return "Hello, " + name;
   }
}

If the bean is @Named then you can simply pass in the name to 
Seam.Component.create() in JavaScript, otherwise you can use a 
combination of bean type and qualifiers.  I need to still do some work 
on the API, instead of Seam.Component.create() I'm thinking 
Seam.Bean.instance() instead.


On 30/11/09 12:07, Shane Bryzak wrote:
> Good point - isn't this simply a case though of implementing the
> equals() and hashCode() methods and checking that the members are equal,
> i.e. the same way that AnnotationLiteral does it?
>
> On 30/11/09 06:36, Stuart Douglas wrote:
>    
>> Does it still work when the annotation has members? That was why I needed the javassist.
>>
>> Stuart
>>
>> ________________________________________
>> From: seam-dev-bounces at lists.jboss.org [seam-dev-bounces at lists.jboss.org] On Behalf Of Shane Bryzak [sbryzak at redhat.com]
>> Sent: Monday, 30 November 2009 5:34 AM
>> To: Gavin King
>> Cc: seam-dev at lists.jboss.org
>> Subject: Re: [seam-dev] First cab off the rank!
>>
>> Nope, just wrote my own impl of Annotation which I could then pass into
>> BeanManager.getBeans().
>>
>> On 30/11/09 04:32, Gavin King wrote:
>>
>>      
>>> You used a jdk dynamicproxy? Probably a better idea.
>>>
>>> Sent from my iPhone
>>>
>>> On Nov 29, 2009, at 1:01 PM, Shane Bryzak<sbryzak at redhat.com>   wrote:
>>>
>>>
>>>        
>>>> Done, although I didn't need to use Javassist. ;)
>>>>
>>>> On 30/11/09 02:38, Gavin King wrote:
>>>>
>>>>          
>>>>> Stuart has some code to do this using javassist.
>>>>>
>>>>> On Sun, Nov 29, 2009 at 2:00 AM, Shane Bryzak<sbryzak at redhat.com>
>>>>> wrote:
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>>> Almost got this working, however I need to be able to reflectively
>>>>>> create an
>>>>>> AnnotationLiteral, given a String containing the fully qualified
>>>>>> name of the
>>>>>> qualifier.  Anyone done this before?
>>>>>>
>>>>>>
>>>>>>              
>>>>>
>>>>>
>>>>>            
>>>>
>>>>          
>> _______________________________________________
>> seam-dev mailing list
>> seam-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>
>>      
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>    



More information about the seam-dev mailing list