[webbeans-commits] Webbeans SVN: r1663 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: bean and 3 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Mon Feb 23 16:20:06 EST 2009
Author: dallen6
Date: 2009-02-23 16:20:06 -0500 (Mon, 23 Feb 2009)
New Revision: 1663
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
Log:
Some fixes to toString() and deprecation of getBindings() for annotated items.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -90,7 +90,7 @@
}
if (resolvedBeans.size() > 1)
{
- throw new AmbiguousDependencyException("The injection point " + injectionPoint + " has ambiguos dependencies for type " + type + " and binding types " + bindings + " in " + bean);
+ throw new AmbiguousDependencyException("The injection point " + injectionPoint + " has ambiguous dependencies for type " + type + " and binding types " + bindings + " in " + bean);
}
Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
if (MetaDataCache.instance().getScopeModel(resolvedBean.getScopeType()).isNormal() && !Proxies.isTypeProxyable(type))
@@ -140,11 +140,11 @@
{
if (!hasHigherPrecedence(bean.getDeploymentType(), abstractBean.getSpecializedBean().getDeploymentType()))
{
- throw new InconsistentSpecializationException("Specializing bean must have a higher precedence deployment type than the specialized bean");
+ throw new InconsistentSpecializationException("Specializing bean must have a higher precedence deployment type than the specialized bean: " + bean);
}
if (specializedBeans.contains(abstractBean.getSpecializedBean()))
{
- throw new InconsistentSpecializationException("Two beans cannot specialize the same bean");
+ throw new InconsistentSpecializationException("Two beans cannot specialize the same bean: " + bean);
}
specializedBeans.add(abstractBean.getSpecializedBean());
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2009-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -36,7 +36,7 @@
*
* @author David Allen
*
- * @param <T>
+ * @param <T> The actual type of the event object
* @param <S>
*/
public class EventBean<T, S> extends AbstractFacadeBean<Event<T>, S, T>
@@ -86,7 +86,7 @@
{
if (!this.getAnnotatedItem().getType().equals(Event.class))
{
- throw new DefinitionException("Observable field/parameter is not of type Event<T>: " + this.getAnnotatedItem());
+ throw new DefinitionException("Event field/parameter is not of type Event<T>: " + this.getAnnotatedItem());
}
}
@@ -164,17 +164,11 @@
public String toString()
{
StringBuilder buffer = new StringBuilder();
- buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
- if (getName() == null)
- {
- buffer.append(" unnamed event bean");
- }
- else
- {
- buffer.append(" enterprise bean '" + getName() + "'");
- }
- buffer.append(" [" + getType().getName() + "]\n");
- buffer.append(" API types " + getTypes() + ", binding types " + getBindings() + "\n");
+ buffer.append(Names.scopeTypeToString(getScopeType()));
+ buffer.append("Event bean ");
+ buffer.append(getType().getName() + "\n");
+ buffer.append(" API types = ").append(Names.typesToString(getTypes())).append(", binding types = " + Names.annotationsToString(getBindings()));
+ buffer.append("\n");
return buffer.toString();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java 2009-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -4,11 +4,13 @@
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Arrays;
+import java.util.HashSet;
import javax.inject.TypeLiteral;
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem;
+import org.jboss.webbeans.util.Names;
/**
* Extension of an element which bases equality not only on type, but also on
@@ -40,12 +42,12 @@
if (type instanceof ParameterizedType)
{
this.actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
- this._string = rawType.toString() + "<" + Arrays.asList(actualTypeArguments).toString() + ">; binding types " + annotations;
+ this._string = rawType.toString() + "<" + Arrays.asList(actualTypeArguments).toString() + ">; binding types = " + Names.annotationsToString(new HashSet<Annotation>(Arrays.asList(annotations)));
}
else
{
this.actualTypeArguments = new Type[0];
- this._string = rawType.toString() +"; binding types " + annotations;
+ this._string = rawType.toString() +"; binding types = " + Names.annotationsToString(new HashSet<Annotation>(Arrays.asList(annotations)));
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2009-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -85,6 +85,7 @@
*
* @returns A set of binding types present on the type. Returns an empty set
* if there are no matches.
+ * @deprecated This reflection type should not know about JSR-299 binding types
*/
public Set<Annotation> getBindings();
@@ -93,6 +94,7 @@
*
* @returns An array of binding types present on the type. Returns an empty
* array if there are no matches.
+ * @deprecated This reflection type should not know about JSR-299 binding types
*/
public Annotation[] getBindingsAsArray();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -235,7 +235,7 @@
{
return toString;
}
- toString = "Annotated method " + Names.methodToString(method);
+ toString = "Annotated method on class " + getDeclaringClass().getName() + Names.methodToString(method);
return toString;
}
More information about the weld-commits
mailing list