tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r673290 - in /tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon: ItemList2ObjectTransformer.java Value2JavaArray.java
Date Wed, 02 Jul 2008 06:14:14 GMT
Author: rfeng
Date: Tue Jul  1 23:14:13 2008
New Revision: 673290

URL: http://svn.apache.org/viewvc?rev=673290&view=rev
Log:
Fix the compilation errors

Modified:
    tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/ItemList2ObjectTransformer.java
    tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2JavaArray.java

Modified: tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/ItemList2ObjectTransformer.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/ItemList2ObjectTransformer.java?rev=673290&r1=673289&r2=673290&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/ItemList2ObjectTransformer.java
(original)
+++ tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/ItemList2ObjectTransformer.java
Tue Jul  1 23:14:13 2008
@@ -53,106 +53,101 @@
  * 
  * @version $Rev: 659284 $ $Date: 2008-05-22 14:26:18 -0800 (Thu, 22 May 2008) $
  */
-public class ItemList2ObjectTransformer extends
-		BaseTransformer<ItemList, Object> implements
-		PullTransformer<ItemList, Object> {
+public class ItemList2ObjectTransformer extends BaseTransformer<ItemList, Object> implements
+    PullTransformer<ItemList, Object> {
 
-	private NodeInfo2DataObjectTransformer nodeInfo2DataObjectTransformer = new NodeInfo2DataObjectTransformer();
+    private NodeInfo2DataObjectTransformer nodeInfo2DataObjectTransformer = new NodeInfo2DataObjectTransformer();
 
-	public ItemList2ObjectTransformer() {
-	}
+    public ItemList2ObjectTransformer() {
+    }
 
-	@Override
-	protected Class<ItemList> getSourceType() {
-		return ItemList.class;
-	}
+    @Override
+    protected Class<ItemList> getSourceType() {
+        return ItemList.class;
+    }
 
-	@Override
-	protected Class<Object> getTargetType() {
-		return Object.class;
-	}
+    @Override
+    protected Class<Object> getTargetType() {
+        return Object.class;
+    }
 
-	@Override
-	public int getWeight() {
-		return 30 + nodeInfo2DataObjectTransformer.getWeight();
-	}
+    @Override
+    public int getWeight() {
+        return 30 + nodeInfo2DataObjectTransformer.getWeight();
+    }
 
-	public Object transform(ItemList source, TransformationContext context) {
+    public Object transform(ItemList source, TransformationContext context) {
 
-		if (source.size() == 0) {
-			return null;
-		}
+        if (source.size() == 0) {
+            return null;
+        }
 
-		Class<?> targetType = context.getTargetDataType().getPhysical();
+        Class<?> targetType = context.getTargetDataType().getPhysical();
 
-		if (targetType.isArray()) {
-			int i = 0;
-			Class<?> componentClass = targetType.getComponentType();
-			Object[] result = (Object[]) Array.newInstance(componentClass,
-					source.size());
+        if (targetType.isArray()) {
+            int i = 0;
+            Class<?> componentClass = targetType.getComponentType();
+            Object[] result = (Object[])Array.newInstance(componentClass, source.size());
 
-			try {
+            try {
 
-				if (componentClass.isAssignableFrom(NodeInfo.class)
-						|| componentClass.isAssignableFrom(Value.class)) {
+                if (componentClass.isAssignableFrom(NodeInfo.class) || componentClass.isAssignableFrom(Value.class))
{
 
-					for (Item item : source) {
-						result[i++] = item;
-					}
+                    for (Item item : source) {
+                        result[i++] = item;
+                    }
 
-				} else {
+                } else {
 
-					for (Item item : source) {
+                    for (Item item : source) {
 
-						if (item instanceof NodeInfo) {
-							result[i] = nodeInfo2DataObjectTransformer
-									.transform((NodeInfo) item, context);
+                        if (item instanceof NodeInfo) {
+                            result[i] = nodeInfo2DataObjectTransformer.transform((NodeInfo)item,
context);
 
-						} else if (item instanceof Value) {
-							result[i] = Value.convertToJava(item);
+                        } else if (item instanceof Value) {
+                            result[i] = Value.convert(item);
 
-						} else {
-							result[i] = item;
-						}
+                        } else {
+                            result[i] = item;
+                        }
 
-						i++;
+                        i++;
 
-					}
+                    }
 
-				}
+                }
 
-			} catch (ArrayStoreException ex) {
-				throw new TransformationException(ex);
+            } catch (ArrayStoreException ex) {
+                throw new TransformationException(ex);
 
-			} catch (XPathException ex) {
-				throw new TransformationException(ex);
-			}
+            } catch (XPathException ex) {
+                throw new TransformationException(ex);
+            }
 
-			return result;
+            return result;
 
-		} else {
-			Item item = source.iterator().next();
+        } else {
+            Item item = source.iterator().next();
 
-			if (item.getClass().isAssignableFrom(targetType)) {
-				return item;
+            if (item.getClass().isAssignableFrom(targetType)) {
+                return item;
 
-			} else if (item instanceof NodeInfo) {
-				return nodeInfo2DataObjectTransformer.transform(
-						(NodeInfo) item, context);
+            } else if (item instanceof NodeInfo) {
+                return nodeInfo2DataObjectTransformer.transform((NodeInfo)item, context);
 
-			} else {
+            } else {
 
-				try {
-					return Value.convertToJava(item);
+                try {
+                    return Value.convert(item);
 
-				} catch (XPathException e) {
-					throw new TransformationException(e);
-				}
+                } catch (XPathException e) {
+                    throw new TransformationException(e);
+                }
 
-			}
+            }
 
-		}
+        }
 
-	}
+    }
 
 }

Modified: tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2JavaArray.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2JavaArray.java?rev=673290&r1=673289&r2=673290&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2JavaArray.java
(original)
+++ tuscany/java/sca/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2JavaArray.java
Tue Jul  1 23:14:13 2008
@@ -20,8 +20,6 @@
 
 import java.lang.reflect.Array;
 
-import net.sf.saxon.om.Item;
-import net.sf.saxon.om.NodeInfo;
 import net.sf.saxon.trans.XPathException;
 import net.sf.saxon.value.Value;
 
@@ -29,50 +27,48 @@
 import org.apache.tuscany.sca.databinding.TransformationContext;
 import org.apache.tuscany.sca.databinding.TransformationException;
 import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.saxon.collection.ItemList;
 
 /**
  * Transforms a Value object to a Java Object and return it in an array.
  * 
  * @version $Rev: 659284 $ $Date: 2008-05-22 14:26:18 -0800 (Thu, 22 May 2008) $
  */
-public class Value2JavaArray extends
-		BaseTransformer<Value, Object[]> implements
-		PullTransformer<Value, Object[]> {
-
-	public Value2JavaArray() {}
-
-	@Override
-	protected Class<Value> getSourceType() {
-		return Value.class;
-	}
-
-	@Override
-	protected Class<Object[]> getTargetType() {
-		return Object[].class;
-	}
-
-	@Override
-	public int getWeight() {
-		return super.getWeight() + 100;
-	}
-
-	public Object[] transform(Value source, TransformationContext context) {
-		
-		try {
-			Object object = Value.convertToJava(Value.asItem(source));
-			
-			Class<?> componentClass = context.getTargetDataType().getPhysical().getComponentType();
-			Object[] result = (Object[]) Array.newInstance(componentClass, 1);
-			
-			result[0] = object;
-			
-			return result;
-			
-		} catch (XPathException e) {
-			throw new TransformationException(e.getMessage());
-		}
+public class Value2JavaArray extends BaseTransformer<Value, Object[]> implements PullTransformer<Value,
Object[]> {
 
-	}
+    public Value2JavaArray() {
+    }
+
+    @Override
+    protected Class<Value> getSourceType() {
+        return Value.class;
+    }
+
+    @Override
+    protected Class<Object[]> getTargetType() {
+        return Object[].class;
+    }
+
+    @Override
+    public int getWeight() {
+        return super.getWeight() + 100;
+    }
+
+    public Object[] transform(Value source, TransformationContext context) {
+
+        try {
+            Object object = Value.convert(Value.asItem(source));
+
+            Class<?> componentClass = context.getTargetDataType().getPhysical().getComponentType();
+            Object[] result = (Object[])Array.newInstance(componentClass, 1);
+
+            result[0] = object;
+
+            return result;
+
+        } catch (XPathException e) {
+            throw new TransformationException(e.getMessage());
+        }
+
+    }
 
 }



Mime
View raw message