[seam-commits] Seam SVN: r12703 - in modules/xml/trunk/impl: src/main/java/org/jboss/seam/xml/bootstrap and 4 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon May 10 07:57:28 EDT 2010
Author: swd847
Date: 2010-05-10 07:57:27 -0400 (Mon, 10 May 2010)
New Revision: 12703
Modified:
modules/xml/trunk/impl/pom.xml
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/BeanResult.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/GenericBeanResult.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/generic/GenericBeanTest.java
Log:
updated to build against weld-extensions head
Modified: modules/xml/trunk/impl/pom.xml
===================================================================
--- modules/xml/trunk/impl/pom.xml 2010-05-10 10:50:26 UTC (rev 12702)
+++ modules/xml/trunk/impl/pom.xml 2010-05-10 11:57:27 UTC (rev 12703)
@@ -49,6 +49,13 @@
<version>1.0.1-Final</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ <version>1.5.10</version>
+ </dependency>
<dependency>
<groupId>org.testng</groupId>
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java 2010-05-10 10:50:26 UTC (rev 12702)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java 2010-05-10 11:57:27 UTC (rev 12703)
@@ -35,6 +35,7 @@
import org.jboss.seam.xml.annotations.internal.ApplyQualifiers;
import org.jboss.seam.xml.core.BeanResult;
+import org.jboss.seam.xml.core.BeanResultType;
import org.jboss.seam.xml.core.GenericBeanResult;
import org.jboss.seam.xml.core.XmlConfiguredBean;
import org.jboss.seam.xml.core.XmlId;
@@ -45,8 +46,8 @@
import org.jboss.seam.xml.parser.ParserMain;
import org.jboss.seam.xml.parser.SaxNode;
import org.jboss.seam.xml.util.FileDataReader;
+import org.jboss.weld.extensions.annotated.AnnotatedTypeBuilder;
import org.jboss.weld.extensions.util.AnnotationInstanceProvider;
-import org.jboss.weld.extensions.util.annotated.NewAnnotatedTypeBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -151,9 +152,9 @@
for (BeanResult<?> bb : r.getBeans())
{
GenericBeanResult found = null;
- for(Class g : genericBeans.keySet())
+ for (Class<?> g : genericBeans.keySet())
{
- if(g.isAssignableFrom(bb.getType()))
+ if (g.isAssignableFrom(bb.getType()))
{
found = genericBeans.get(g);
break;
@@ -196,7 +197,7 @@
return;
}
boolean found = false;
- NewAnnotatedTypeBuilder builder = new NewAnnotatedTypeBuilder(event.getAnnotatedType());
+ AnnotatedTypeBuilder builder = AnnotatedTypeBuilder.newInstance(event.getAnnotatedType());
for (XmlResult r : results)
{
for (BeanResult<?> i : r.getInterfaces())
@@ -312,12 +313,16 @@
{
AnnotatedType<?> type = c.getBuilder().create();
- NewAnnotatedTypeBuilder<?> gb = new NewAnnotatedTypeBuilder(type);
- //if the original type was qualified @Default we add that as well
- if(!isQualifierPresent(type, beanManager))
+ AnnotatedTypeBuilder<?> gb = AnnotatedTypeBuilder.newInstance(type);
+ if (c.getBeanType() == BeanResultType.SPECIALISE)
{
- gb.addToClass( new DefaultLiteral());
+ gb.readAnnotationsFromUnderlyingType();
}
+ // if the original type was qualified @Default we add that as well
+ if (!isQualifierPresent(type, beanManager))
+ {
+ gb.addToClass(new DefaultLiteral());
+ }
// we always apply qualifiers to the actual type
for (Annotation q : qualifiers)
{
@@ -326,11 +331,13 @@
for (AnnotatedField<?> f : type.getFields())
{
if (f.isAnnotationPresent(ApplyQualifiers.class))
- {
- //we need to manually add @default as it stops being applied when
- //we add our qualifiers, however if we are deling with the main type we do not
- //bother, as it should not be qualified @Default
- if(!isQualifierPresent(f, beanManager) && f.getJavaMember().getType() != rootType.getJavaClass())
+ {
+ // we need to manually add @default as it stops being applied
+ // when
+ // we add our qualifiers, however if we are deling with the main
+ // type we do not
+ // bother, as it should not be qualified @Default
+ if (!isQualifierPresent(f, beanManager) && f.getJavaMember().getType() != rootType.getJavaClass())
{
gb.addToField(f.getJavaMember(), new DefaultLiteral());
}
@@ -342,10 +349,10 @@
}
for (AnnotatedMethod<?> m : type.getMethods())
{
-
+
if (m.isAnnotationPresent(ApplyQualifiers.class))
{
- if(!isQualifierPresent(m, beanManager))
+ if (!isQualifierPresent(m, beanManager))
{
gb.addToMethod(m.getJavaMember(), new DefaultLiteral());
}
@@ -357,12 +364,12 @@
for (AnnotatedParameter<?> p : m.getParameters())
{
-
+
if (p.isAnnotationPresent(ApplyQualifiers.class))
{
- if(!isQualifierPresent(p, beanManager) && p.getBaseType() != rootType.getJavaClass())
+ if (!isQualifierPresent(p, beanManager) && p.getBaseType() != rootType.getJavaClass())
{
- gb.addToMethodParameter(m.getJavaMember(),p.getPosition(), new DefaultLiteral());
+ gb.addToMethodParameter(m.getJavaMember(), p.getPosition(), new DefaultLiteral());
}
for (Annotation q : qualifiers)
{
@@ -376,7 +383,7 @@
{
if (con.isAnnotationPresent(ApplyQualifiers.class))
{
- if(!isQualifierPresent(con, beanManager))
+ if (!isQualifierPresent(con, beanManager))
{
gb.addToConstructor((Constructor) con.getJavaMember(), new DefaultLiteral());
}
@@ -390,9 +397,9 @@
{
if (p.isAnnotationPresent(ApplyQualifiers.class) && p.getBaseType() != rootType.getJavaClass())
{
- if(!isQualifierPresent(p, beanManager))
+ if (!isQualifierPresent(p, beanManager))
{
- gb.addToConstructorParameter((Constructor) con.getJavaMember(),p.getPosition(), new DefaultLiteral());
+ gb.addToConstructorParameter((Constructor) con.getJavaMember(), p.getPosition(), new DefaultLiteral());
}
for (Annotation q : qualifiers)
{
@@ -406,22 +413,24 @@
}
return ret;
}
-
+
public boolean isQualifierPresent(Annotated f, BeanManager beanManager)
{
- for(Annotation a : f.getAnnotations())
+ for (Annotation a : f.getAnnotations())
{
- if(a.annotationType().equals(Named.class))
+ if (a.annotationType().equals(Named.class))
{
continue;
}
- if(beanManager.isQualifier(a.annotationType()))
+ if (beanManager.isQualifier(a.annotationType()))
{
return true;
}
}
return false;
}
-
- public static class DefaultLiteral extends AnnotationLiteral<Default> implements Default {};
+
+ public static class DefaultLiteral extends AnnotationLiteral<Default> implements Default
+ {
+ };
}
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/BeanResult.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/BeanResult.java 2010-05-10 10:50:26 UTC (rev 12702)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/BeanResult.java 2010-05-10 11:57:27 UTC (rev 12703)
@@ -4,21 +4,25 @@
*/
package org.jboss.seam.xml.core;
-import org.jboss.weld.extensions.util.annotated.NewAnnotatedTypeBuilder;
+import org.jboss.weld.extensions.annotated.AnnotatedTypeBuilder;
public class BeanResult<X>
{
- NewAnnotatedTypeBuilder<X> builder;
+ AnnotatedTypeBuilder<X> builder;
Class<X> type;
BeanResultType beanType = BeanResultType.ADD;
public BeanResult(Class<X> type, boolean readAnnotations)
{
this.type = type;
- builder = new NewAnnotatedTypeBuilder<X>(type, readAnnotations);
+ builder = AnnotatedTypeBuilder.newInstance(type);
+ if (readAnnotations)
+ {
+ builder.readAnnotationsFromUnderlyingType();
+ }
}
- public NewAnnotatedTypeBuilder<X> getBuilder()
+ public AnnotatedTypeBuilder<X> getBuilder()
{
return builder;
}
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/GenericBeanResult.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/GenericBeanResult.java 2010-05-10 10:50:26 UTC (rev 12702)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/GenericBeanResult.java 2010-05-10 11:57:27 UTC (rev 12703)
@@ -5,7 +5,7 @@
public class GenericBeanResult
{
- final Class genericBean;
+ final Class<?> genericBean;
final Set<BeanResult<?>> secondaryBeans;
@@ -15,7 +15,7 @@
this.secondaryBeans = new HashSet<BeanResult<?>>(secondaryBeans);
}
- public Class getGenericBean()
+ public Class<?> getGenericBean()
{
return genericBean;
}
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-05-10 10:50:26 UTC (rev 12702)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-05-10 11:57:27 UTC (rev 12703)
@@ -12,7 +12,7 @@
import java.util.Map.Entry;
import org.jboss.seam.xml.util.XmlConfigurationException;
-import org.jboss.weld.extensions.util.ReflectionUtils;
+import org.jboss.weld.extensions.util.Reflections;
public class ClassXmlItem extends AbstractXmlItem
{
@@ -40,7 +40,7 @@
for (Entry<String, String> e : attributes.entrySet())
{
- Field field = ReflectionUtils.getField(getJavaClass(), e.getKey());
+ Field field = Reflections.getField(getJavaClass(), e.getKey());
if (field != null)
{
values.add(new FieldXmlItem(this, field, e.getValue(), document, lineno));
@@ -48,9 +48,9 @@
else
{
String methodName = "set" + Character.toUpperCase(e.getKey().charAt(0)) + e.getKey().substring(1);
- if (ReflectionUtils.methodExists(getJavaClass(), methodName))
+ if (Reflections.methodExists(getJavaClass(), methodName))
{
- Set<Method> methods = ReflectionUtils.getMethods(getJavaClass());
+ Set<Method> methods = Reflections.getMethods(getJavaClass());
for (Method m : methods)
{
if (m.getName().equals(methodName) && m.getParameterTypes().length == 1)
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java 2010-05-10 10:50:26 UTC (rev 12702)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java 2010-05-10 11:57:27 UTC (rev 12703)
@@ -32,9 +32,9 @@
import org.jboss.seam.xml.parser.namespace.RootNamespaceElementResolver;
import org.jboss.seam.xml.util.XmlConfigurationException;
import org.jboss.seam.xml.util.XmlObjectConverter;
+import org.jboss.weld.extensions.annotated.AnnotatedTypeBuilder;
import org.jboss.weld.extensions.util.AnnotationInstanceProvider;
-import org.jboss.weld.extensions.util.ReflectionUtils;
-import org.jboss.weld.extensions.util.annotated.NewAnnotatedTypeBuilder;
+import org.jboss.weld.extensions.util.Reflections;
/**
* Builds an XML result from sax nodes
@@ -292,7 +292,7 @@
// if it is an extend we want to read the annotations from the underlying
// class
BeanResult<?> result = new BeanResult(rb.getJavaClass(), extend);
- NewAnnotatedTypeBuilder<?> type = result.getBuilder();
+ AnnotatedTypeBuilder<?> type = result.getBuilder();
// list of constructor arguments
List<ParameterXmlItem> constList = new ArrayList<ParameterXmlItem>();
@@ -436,7 +436,7 @@
{
params[i] = constList.get(i).getJavaClass();
}
- Constructor<?> ret = ReflectionUtils.getConstructor(bean.getJavaClass(), params);
+ Constructor<?> ret = Reflections.getConstructor(bean.getJavaClass(), params);
if (ret == null)
{
throw new XmlConfigurationException("Could not resolve constructor for " + bean.getJavaClass() + " with arguments " + params, bean.getDocument(), bean.getLineno());
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java 2010-05-10 10:50:26 UTC (rev 12702)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java 2010-05-10 11:57:27 UTC (rev 12703)
@@ -21,7 +21,7 @@
import org.jboss.seam.xml.model.XmlItemType;
import org.jboss.seam.xml.parser.SaxNode;
import org.jboss.seam.xml.util.XmlConfigurationException;
-import org.jboss.weld.extensions.util.ReflectionUtils;
+import org.jboss.weld.extensions.util.Reflections;
public class PackageNamespaceElementResolver implements NamespaceElementResolver
{
@@ -104,8 +104,8 @@
{
Class<?> p = parent.getJavaClass();
Field f = null;
- boolean methodFound = ReflectionUtils.methodExists(p, name);
- f = ReflectionUtils.getField(p, name);
+ boolean methodFound = Reflections.methodExists(p, name);
+ f = Reflections.getField(p, name);
if (methodFound && f != null)
{
@@ -121,9 +121,9 @@
}
String methodName = "set" + Character.toUpperCase(name.charAt(0)) + name.substring(1);
- if (ReflectionUtils.methodExists(p, methodName))
+ if (Reflections.methodExists(p, methodName))
{
- Set<Method> methods = ReflectionUtils.getMethods(p);
+ Set<Method> methods = Reflections.getMethods(p);
for (Method m : methods)
{
if (m.getName().equals(methodName) && m.getParameterTypes().length == 1)
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/generic/GenericBeanTest.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/generic/GenericBeanTest.java 2010-05-10 10:50:26 UTC (rev 12702)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/generic/GenericBeanTest.java 2010-05-10 11:57:27 UTC (rev 12703)
@@ -29,7 +29,6 @@
{
});
assert dep.getValue() == 11 : " actual " + dep.getValue();
- ;
}
@Test
More information about the seam-commits
mailing list