Errai 3.0.1-SNAPSHOT

org.jboss.errai.ioc.client.container
Class BeanRef

java.lang.Object
  extended by org.jboss.errai.ioc.client.container.BeanRef

public final class BeanRef
extends Object

This class is used as a resolver class within the bean manager to represent a unique bean definition for a given type and combination of qualifiers. It provides consistent equals(Object) and hashCode() functionality for any two instances of BeanRef.

For example:

   
     BeanRef beanRefA = new BeanRef(String.class, new Annotation[] { new Foo() { ... } });
     BeanRef beanRefB = new BeanRef(String.class, new Annotation[] { new Foo() { ... } });
     assertTrue(beanRefA.equals(beanRefB)); // should equal true!
   
 

Author:
Mike Brock

Constructor Summary
BeanRef(Class<?> clazz, Annotation[] annotations)
          Constructs a new instance of BeanRef with the given bean type and qualifiers.
 
Method Summary
 boolean equals(Object o)
           
 Annotation[] getAnnotations()
          Return an array of qualifiers associated with this bean.
 Class<?> getClazz()
          Return the bean type.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanRef

public BeanRef(Class<?> clazz,
               Annotation[] annotations)
Constructs a new instance of BeanRef with the given bean type and qualifiers. Neither the or the parameter may be null.

Parameters:
clazz - the bean type.
annotations - an array of qualifiers associated with this bean.
Method Detail

getClazz

public Class<?> getClazz()
Return the bean type.

Returns:
an instance of Class representing the type of this bean.

getAnnotations

public Annotation[] getAnnotations()
Return an array of qualifiers associated with this bean.

Returns:
an array of {Annotation} representing the qualifiers for this bean.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.