geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r462934 - in /geronimo/xbean/sandbox: xbean-apt/src/main/java/org/apache/xbean/factory/FactoryBeanSupport.java xbean-apt/src/main/resources/FactoryBean.vm xbean-factory/src/test/java/org/apache/xbean/factory/XBeanJaxbTest.java
Date Wed, 11 Oct 2006 20:35:26 GMT
Author: chirino
Date: Wed Oct 11 13:35:24 2006
New Revision: 462934

URL: http://svn.apache.org/viewvc?view=rev&rev=462934
Log:
fix compile issue

Modified:
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/factory/FactoryBeanSupport.java
    geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm
    geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/XBeanJaxbTest.java

Modified: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/factory/FactoryBeanSupport.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/factory/FactoryBeanSupport.java?view=diff&rev=462934&r1=462933&r2=462934
==============================================================================
--- geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/factory/FactoryBeanSupport.java
(original)
+++ geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/factory/FactoryBeanSupport.java
Wed Oct 11 13:35:24 2006
@@ -16,6 +16,9 @@
  */
 package org.apache.xbean.factory;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
@@ -23,10 +26,6 @@
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlID;
 import javax.xml.bind.annotation.XmlTransient;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
 
 /**
  * A base class for a code generated factory bean
@@ -37,18 +36,12 @@
 
     private String _id;
     private Boolean _singleton;
-    private Class _objectType;
-
-    public FactoryBeanSupport() {
-        ParameterizedType genericSuperclass = (ParameterizedType) getClass().getGenericSuperclass();
-        Type[] typeArguments = genericSuperclass.getActualTypeArguments();
-        this._objectType = (Class) typeArguments[0];
-    }
 
     @XmlTransient
-    public Class get_objectType() {
-        return _objectType;
-    }
+    abstract public Class get_objectType();
+    
+    @XmlTransient
+    abstract public T getObject();
 
     @XmlAttribute(name = "singleton", namespace = "http://www.springframework/beans/TODO",
required = false)
     public Boolean get_singleton() {
@@ -69,16 +62,14 @@
         this._id = _id;
     }
 
-    @XmlTransient
-    public abstract T getObject();
-
     public void write(OutputStream out) throws JAXBException {
         Marshaller marshaller = createJAXBContext().createMarshaller();
         marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
         marshaller.marshal(this, out);
     }
 
-    public FactoryBeanSupport<T> read(InputStream in) throws JAXBException {
+    @SuppressWarnings("unchecked")
+	public FactoryBeanSupport<T> read(InputStream in) throws JAXBException {
         Unmarshaller unmarshaller = createJAXBContext().createUnmarshaller();
         return (FactoryBeanSupport<T>) unmarshaller.unmarshal(in);
     }
@@ -86,4 +77,5 @@
     protected JAXBContext createJAXBContext() throws JAXBException {
         return JAXBContext.newInstance(getClass());
     }
+
 }

Modified: geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm?view=diff&rev=462934&r1=462933&r2=462934
==============================================================================
--- geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm (original)
+++ geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm Wed Oct 11 13:35:24
2006
@@ -13,6 +13,14 @@
 @XmlRootElement
 public class $f.factoryName extends FactoryBeanSupport<$f.className> {
 
+	@XmlTransient
+	@Override
+	public Class get_objectType() {
+		return ${f.className}.class;
+	}
+
+	@XmlTransient
+	@Override
     public $f.className getObject() {
         ${f.className} _object = new ${f.className}();
 #foreach ( $prop in $f.properties)
@@ -21,13 +29,11 @@
         return _object;
     }
 
-
     public void configure($f.className _object) {
 #foreach ( $prop in $f.properties)
         ${prop.name} = _object.get${prop.name}();
 #end
     }
-
 
 #foreach ( $prop in $f.properties)
     private $prop.type $prop.name;

Modified: geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/XBeanJaxbTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/XBeanJaxbTest.java?view=diff&rev=462934&r1=462933&r2=462934
==============================================================================
--- geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/XBeanJaxbTest.java
(original)
+++ geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/XBeanJaxbTest.java
Wed Oct 11 13:35:24 2006
@@ -37,7 +37,8 @@
 
         User user = super.loadUser();
         UserFactoryBean factory = new UserFactoryBean();
-        factory.write(new FileOutputStream(file), user);
+        factory.configure(user);
+        factory.write(new FileOutputStream(file));
 
         // in case there's caching, lets make another
         factory = new UserFactoryBean();



Mime
View raw message