Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@549 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Dec 18, 2008
1 parent 8079947 commit ed83c48
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
Expand Up @@ -83,7 +83,18 @@ public EnterpriseBean(Class<T> type, ManagerImpl manager)
protected void init()
{
super.init();
ejbDescriptor = (EjbDescriptor<T>) EjbDescriptorCache.instance().get(getType().getSimpleName() + "/local");
Iterable<EjbDescriptor<T>> ejbDescriptors = EjbDescriptorCache.instance().get(getType());
for (EjbDescriptor<T> ejbDescriptor : ejbDescriptors)
{
if (this.ejbDescriptor == null)
{
this.ejbDescriptor = ejbDescriptor;
}
else
{
throw new RuntimeException("TODO Multiple EJBs have the same bean class! " + getType() );
}
}
initRemoveMethod();
initInjectionPoints();
checkEnterpriseBeanTypeAllowed();
Expand Down
Expand Up @@ -82,9 +82,9 @@ public EjbDescriptor<?> get(String ejbName)
* @param beanClass The EJB class
* @return An iterator
*/
public Iterable<EjbDescriptor<?>> get(Class<?> beanClass)
public <T> Iterable<EjbDescriptor<T>> get(Class<T> beanClass)
{
return ejbsByBeanClass.get(beanClass);
return (Iterable) ejbsByBeanClass.get(beanClass);
}

/**
Expand Down
Expand Up @@ -96,5 +96,50 @@ public boolean isStateless()
{
return type.isAnnotationPresent(Stateless.class);
}

@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append(getEjbName());
if (isStateful())
{
builder.append(" (SFSB)");
}
if (isStateless())
{
builder.append(" (SLSB)");
}
if (isSingleton())
{
builder.append(" (Singleton)");
}
if (isMessageDriven())
{
builder.append(" (MDB)");
}
builder.append("; BeanClass: " + getType() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
return builder.toString();
}

@Override
public boolean equals(Object other)
{
if (other instanceof EjbDescriptor)
{
EjbDescriptor<T> that = (EjbDescriptor<T>) other;
return this.getEjbName().equals(that.getEjbName());
}
else
{
return false;
}
}

@Override
public int hashCode()
{
return getEjbName().hashCode();
}

}

0 comments on commit ed83c48

Please sign in to comment.