Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/SimpleDynObjectEncoder.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/SimpleDynObjectEncoder.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/SimpleDynObjectEncoder.java	(revision 1349)
@@ -0,0 +1,166 @@
+
+package org.gvsig.tools.dynobject.impl;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectEncoder;
+
+
+public class SimpleDynObjectEncoder implements DynObjectEncoder {
+
+    @Override
+    public String encode(DynObject value) {
+        return this.encode(value, "UTF-8");
+    }
+
+    @Override
+    public String encode(DynObject value, String charset) {
+        DynClass definition = value.getDynClass();
+        StringBuilder builder = new StringBuilder();
+        builder.append(this.encodePair("_entity_", definition.getFullName(), charset));
+        for (DynField field : definition.getDynFields()) {
+            String name = field.getName();
+            Object v0 = value.getDynValue(name);
+            builder.append(",");
+            builder.append(this.encodePair(name, v0, charset));
+        }
+        return builder.toString();    
+    }
+
+    @Override
+    public DynObject decode(String value) {
+        String[] entries = value.split(",");
+        if( entries==null || entries.length<1 ) {
+            return null;
+        }
+        // first entry is _entity_
+        String[] entryEntity = entries[0].split(":");
+        DynObject output = ToolsLocator.getDynObjectManager().createDynObject(entryEntity[1].trim());
+        return this.decode(value, output, entries, "UTF-8");
+    }
+
+    @Override
+    public DynObject decode(String value, DynObject output) {
+        return this.decode(value, output, "UTF-8");
+    }
+
+    @Override
+    public DynObject decode(String value, DynObject output, String charset) {
+        String[] entries = value.split(",");
+        if( entries==null || entries.length<1 ) {
+            return null;
+        }
+        return this.decode(value, output, entries, "UTF-8");
+    }
+
+    protected DynObject decode(String value, DynObject output, String[] entries, String charset) {
+        DynClass definition = output.getDynClass();
+        for (String entry : entries) {
+            String[] entryPair = entry.split(":");
+            DynField field = definition.getDynField(entryPair[0]);
+            if( field!=null ) {
+                String name = entryPair[0];
+                String v0 = entryPair[1];
+                switch(field.getType()) {
+                    case DataTypes.DYNOBJECT:
+                        DynObject v1 = this.decode( this.decodeValue(v0, charset));
+                        output.setDynValue(name, v0);
+                        break;
+                    case DataTypes.ARRAY:
+                        // TODO: encode array not implemented
+                        break;
+                    case DataTypes.LIST:
+                        // TODO: encode array not implemented
+                        break;
+                    case DataTypes.SET:
+                        // TODO: encode array not implemented
+                        break;
+                    case DataTypes.MAP:
+                        // TODO: encode array not implemented
+                        break;
+                    case DataTypes.OBJECT:
+                        // TODO: encode array not implemented
+                        break;
+                    default:
+                        output.setDynValue(name, this.decodeValue(v0, charset) );
+                        break;
+                }
+            }
+        }
+        return output;
+    }
+
+    @Override
+    public String encodePair(String name, Object value) {
+        return this.encodePair(name, value, "UTF-8");
+    }
+    
+    @Override
+    public String encodePair(String name, Object value, String charset) {
+        if( value == null ) {
+            return name + ":";
+            
+        } else if( value instanceof DynObject ) {
+            return name + ":" + this.encodeValue(this.encode((DynObject) value, charset));
+
+        } else if( value instanceof List ) {
+            // TODO: encode of List not implemented
+            return name + ":";
+            
+        } else if( value instanceof Map ) {
+            // TODO: encode of Map not implemented
+            return name + ":";
+            
+        } else if( value instanceof Set ) {
+            // TODO: encode of Set not implemented
+            return name + ":";
+            
+        } else if( value.getClass().isArray() ) {
+            // TODO: encode of array not implemented
+            return name + ":";
+            
+        } else {
+            return name + ":" + this.encodeValue(value.toString(), charset);
+        }        
+    }
+    
+    @Override
+    public String encodeValue(String value) {
+        return this.encodeValue(value, "UTF-8");
+    }
+
+    @Override
+    public String encodeValue(String value, String charset) {
+        try {
+            return URLEncoder.encode(value, charset);
+        } catch (UnsupportedEncodingException ex) {
+            // Do nothing
+        }
+        return value.replace(",", "%2C");
+    }
+
+    @Override
+    public String decodeValue(String value) {
+        return this.decodeValue(value,"UTF-8");
+    }
+
+    @Override
+    public String decodeValue(String value, String charset) {
+        try {
+            return URLDecoder.decode(value,charset);
+        } catch (UnsupportedEncodingException ex) {
+            // Do nothing
+        }
+        return value.replace("%2C",",");
+    }
+    
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectManager.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectManager.java	(revision 1348)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectManager.java	(revision 1349)
@@ -28,6 +28,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -39,18 +41,22 @@
 import java.util.Set;
 
 import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
 import org.gvsig.tools.dynobject.DynClass;
 import org.gvsig.tools.dynobject.DynClassName;
+import org.gvsig.tools.dynobject.DynField;
 import org.gvsig.tools.dynobject.DynField_LabelAttribute;
 import org.gvsig.tools.dynobject.DynField_v2;
 import org.gvsig.tools.dynobject.DynMethod;
 import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectEncoder;
 import org.gvsig.tools.dynobject.DynObjectManager;
 import org.gvsig.tools.dynobject.DynObjectPagingHelper;
 import org.gvsig.tools.dynobject.DynObjectRuntimeException;
 import org.gvsig.tools.dynobject.DynObjectSet;
 import org.gvsig.tools.dynobject.DynStruct;
 import org.gvsig.tools.dynobject.exception.DuplicateDynClassException;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
 import org.gvsig.tools.dynobject.exception.DynMethodException;
 import org.gvsig.tools.dynobject.exception.DynMethodIllegalCodeException;
 import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
@@ -730,4 +736,34 @@
             }
     	}
     }
+
+    @Override
+    public DynObjectEncoder createSimpleDynObjectEncoder() {
+        return new SimpleDynObjectEncoder();
+    }
+
+    @Override
+    public void copy(DynObject source, DynObject target) {
+        for (DynField field : target.getDynClass().getDynFields() ) {
+            String name = field.getName();
+            try {
+                Object value = source.getDynValue(name);
+                target.setDynValue(name, value);
+            } catch(DynFieldNotFoundException | DefaultDynObject.CoerceValueException ex) {
+                // if field not found in source or types are inconsistent, ignore it.
+            }
+        }
+    }
+    
+    public void clear(DynObject obj) {
+        for (DynField field : obj.getDynClass().getDynFields() ) {
+            String name = field.getName();
+            try {
+                Object value = field.getDefaultValue();
+                obj.setDynValue(name, value);
+            } catch(DefaultDynObject.CoerceValueException ex) {
+                // if types are inconsistent, ignore it.
+            }
+        }        
+    }
 }
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectEncoder.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectEncoder.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectEncoder.java	(revision 1349)
@@ -0,0 +1,27 @@
+package org.gvsig.tools.dynobject;
+
+
+public interface DynObjectEncoder {
+    
+    public String encode(DynObject value);
+    
+    public String encode(DynObject value, String charset);
+    
+    public DynObject decode(String value);
+    
+    public DynObject decode(String value, DynObject output);
+    
+    public DynObject decode(String value, DynObject output, String charset);
+
+    public String encodePair(String name, Object value);
+
+    public String encodePair(String name, Object value, String charset);
+    
+    public String encodeValue(String value);
+    
+    public String encodeValue(String value, String charset);
+
+    public String decodeValue(String value);
+
+    public String decodeValue(String value, String charset);
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectManager.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectManager.java	(revision 1348)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectManager.java	(revision 1349)
@@ -71,6 +71,8 @@
      */
     public DynClass createDynClass(String name, String description);
 
+    public DynObjectEncoder createSimpleDynObjectEncoder();
+    
     /**
      * Create a instance of DynClass with the name and description
      * Indicated as parameters.
@@ -432,5 +434,9 @@
     public Object getAttributeValue(Object obj, String name);
 
     public void setAttributeValue(Object obj, String name, Object value);
+    
+    public void copy(DynObject source, DynObject target);
+    
+    public void clear(DynObject obj);
 
 }
