Author: nickarls
Date: 2009-03-07 17:19:27 -0500 (Sat, 07 Mar 2009)
New Revision: 1810
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EventBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
Log:
WBRI-158
remove multi-lines in bean toStrings
more info from circular deps
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-03-07
22:19:18 UTC (rev 1809)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-03-07
22:19:27 UTC (rev 1810)
@@ -20,6 +20,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
+import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
@@ -296,7 +297,7 @@
CreationalContextImpl<?> creationalContextImpl =
(CreationalContextImpl<?>) creationalContext;
if (creationalContextImpl.containsIncompleteInstance(getDeclaringBean()))
{
- log.warn("Executing producer method on incomplete declaring bean due to
circular injection");
+ log.warn("Executing producer field or method " + getAnnotatedItem()
+ " on incomplete declaring bean " + getDeclaringBean() + " due to circular
injection");
return creationalContextImpl.getIncompleteInstance(getDeclaringBean());
}
}
@@ -361,8 +362,7 @@
{
buffer.append("simple producer bean '" + getName() +
"'");
}
- buffer.append(" [" + getType().getName() + "]\n");
- buffer.append(" API types " + getTypes() + ", binding types "
+ getBindings() + "\n");
+ buffer.append(" [" + getType().getName() + "] API types " +
getTypes() + ", binding types " + getBindings());
return buffer.toString();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-03-07
22:19:18 UTC (rev 1809)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-03-07
22:19:27 UTC (rev 1810)
@@ -276,8 +276,8 @@
{
buffer.append(" enterprise bean '" + getName() +
"'");
}
- buffer.append(" [" + getType().getName() + "]\n");
- buffer.append(" API types " + getTypes() + ", binding types "
+ getBindings() + "\n");
+ buffer.append(" [" + getType().getName() + "] ");
+ buffer.append("API types " + getTypes() + ", binding types " +
getBindings());
return buffer.toString();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EventBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EventBean.java 2009-03-07 22:19:18
UTC (rev 1809)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EventBean.java 2009-03-07 22:19:27
UTC (rev 1810)
@@ -182,9 +182,8 @@
StringBuilder buffer = new StringBuilder();
buffer.append(Names.scopeTypeToString(getScopeType()));
buffer.append("Event bean ");
- buffer.append(getType().getName() + "\n");
+ buffer.append(getType().getName());
buffer.append(" API types =
").append(Names.typesToString(getTypes())).append(", binding types = " +
Names.annotationsToString(getBindings()));
- buffer.append("\n");
return buffer.toString();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-03-07
22:19:18 UTC (rev 1809)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-03-07
22:19:27 UTC (rev 1810)
@@ -112,8 +112,8 @@
{
buffer.append("simple producer field bean '" + getName() +
"'");
}
- buffer.append(" [" + getType().getName() + "]\n");
- buffer.append(" API types " + getTypes() + ", binding types "
+ getBindings() + "\n");
+ buffer.append(" [" + getType().getName() + "] ");
+ buffer.append("API types " + getTypes() + ", binding types " +
getBindings());
return buffer.toString();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-07
22:19:18 UTC (rev 1809)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-07
22:19:27 UTC (rev 1810)
@@ -181,8 +181,8 @@
{
buffer.append("simple producer method bean '" + getName() +
"'");
}
- buffer.append(" [" + getType().getName() + "]\n");
- buffer.append(" API types " + getTypes() + ", binding types "
+ getBindings() + "\n");
+ buffer.append(" [" + getType().getName() + "] ");
+ buffer.append("API types " + getTypes() + ", binding types " +
getBindings());
return buffer.toString();
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java 2009-03-07
22:19:18 UTC (rev 1809)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java 2009-03-07
22:19:27 UTC (rev 1810)
@@ -1,71 +1,71 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.context;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.context.CreationalContext;
-import javax.inject.manager.Bean;
-
-public class CreationalContextImpl<T> implements CreationalContext<T>
-{
-
- private final Map<Bean<?>, Object> incompleteInstances;
- private final Bean<T> bean;
- private final boolean outer;
-
- public CreationalContextImpl(Bean<T> bean)
- {
- this.incompleteInstances = new HashMap<Bean<?>, Object>();
- this.bean = bean;
- this.outer = true;
- }
-
- private CreationalContextImpl(Bean<T> bean, Map<Bean<?>, Object>
incompleteInstances)
- {
- this.incompleteInstances = incompleteInstances;
- this.bean = bean;
- this.outer = false;
- }
-
- public void push(T incompleteInstance)
- {
- incompleteInstances.put(bean, incompleteInstance);
- }
-
- public <S> CreationalContextImpl<S> getCreationalContext(Bean<S>
bean)
- {
- return new CreationalContextImpl<S>(bean, incompleteInstances);
- }
-
- public <S> S getIncompleteInstance(Bean<S> bean)
- {
- return (S) incompleteInstances.get(bean);
- }
-
- public boolean containsIncompleteInstance(Bean<?> bean)
- {
- return incompleteInstances.containsKey(bean);
- }
-
- public boolean isOuter()
- {
- return outer;
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.context;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.context.CreationalContext;
+import javax.inject.manager.Bean;
+
+public class CreationalContextImpl<T> implements CreationalContext<T>
+{
+
+ private final Map<Bean<?>, Object> incompleteInstances;
+ private final Bean<T> bean;
+ private final boolean outer;
+
+ public CreationalContextImpl(Bean<T> bean)
+ {
+ this.incompleteInstances = new HashMap<Bean<?>, Object>();
+ this.bean = bean;
+ this.outer = true;
+ }
+
+ private CreationalContextImpl(Bean<T> bean, Map<Bean<?>, Object>
incompleteInstances)
+ {
+ this.incompleteInstances = incompleteInstances;
+ this.bean = bean;
+ this.outer = false;
+ }
+
+ public void push(T incompleteInstance)
+ {
+ incompleteInstances.put(bean, incompleteInstance);
+ }
+
+ public <S> CreationalContextImpl<S> getCreationalContext(Bean<S>
bean)
+ {
+ return new CreationalContextImpl<S>(bean, new HashMap<Bean<?>,
Object>(incompleteInstances));
+ }
+
+ public <S> S getIncompleteInstance(Bean<S> bean)
+ {
+ return (S) incompleteInstances.get(bean);
+ }
+
+ public boolean containsIncompleteInstance(Bean<?> bean)
+ {
+ return incompleteInstances.containsKey(bean);
+ }
+
+ public boolean isOuter()
+ {
+ return outer;
+ }
+
+}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java 2009-03-07
22:19:18 UTC (rev 1809)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java 2009-03-07
22:19:27 UTC (rev 1810)
@@ -31,9 +31,9 @@
public class FieldInjectionPoint<T> extends ForwardingAnnotatedField<T>
implements AnnotatedInjectionPoint<T, Field>
{
-
+
private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
-
+
private final Bean<?> declaringBean;
private final AnnotatedField<T> field;
@@ -41,7 +41,7 @@
{
return new FieldInjectionPoint<T>(declaringBean, field);
}
-
+
protected FieldInjectionPoint(Bean<?> declaringBean, AnnotatedField<T>
field)
{
this.declaringBean = declaringBean;
@@ -84,7 +84,7 @@
rethrowException(e);
}
}
-
+
public void inject(Object declaringInstance, Object value)
{
try
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-03-07
22:19:18 UTC (rev 1809)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-03-07
22:19:27 UTC (rev 1810)
@@ -169,4 +169,25 @@
return toString;
}
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof AnnotatedField)
+ {
+ AnnotatedField<?> that = (AnnotatedField<?>) other;
+ return this.getDeclaringClass().equals(that.getDeclaringClass()) &&
this.getName().equals(that.getName());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+
+ @Override
+ public int hashCode()
+ {
+ return getDelegate().hashCode();
+ }
+
}