Sunday, October 2, 2011

Code Generator for CustomFieldSerializer

I developed a plugin to generate the code CustomFieldSerializer,
thanks to the suggestion of @ GenSerializer by Flori, the idea is to
use it as follows:

@GenSerializer
public class CategoryItem {
   List<Product> productKey;
   int quantity;
   ....
}

result of the generated code:

public class CategoryItem_CustomFieldSerializer {

  @SuppressWarnings("unchecked")
  public static void deserialize(SerializationStreamReader reader,
CategoryItem instance) throws SerializationException {

instance.setProductKey((java.util.List<com.pe.sondx.shared.entities.Product
>)reader.readObject());
       instance.setQuantity(reader.readInt());
  }

  public static void serialize(SerializationStreamWriter writer,
CategoryItem instance) throws SerializationException {
       if (instance.getProductKey() == null) {
          writer.writeObject(new
java.util.ArrayList<com.pe.sondx.shared.entities.Product>());
       } else {
          writer.writeObject(new
java.util.ArrayList<com.pe.sondx.shared.entities.Product>(instance.getProdu
ctKey()));
       }
       writer.writeInt(instance.getQuantity());
  }
}

...but when compiled into a GWT project throws me the following error:

[DEBUG] [gwtspring] - Validating newly compiled units
        [ERROR] [gwtspring] - Errors in 'file:/E:/workspace/GWTSpring/
src/com/pe/sondx/shared/entities/CategoryItem.java'
                [ERROR] [gwtspring] - Line 3: The import com.sondx
cannot be resolved
                [ERROR] [gwtspring] - Line 6: GenSerializer cannot be
resolved to a type

I have no idea that is the error, here I leave the link where you can
access the source code:

http://code.google.com/p/annotation-serializer-gwt/source/checkout

...maybe someone could help me fix this error, and so too would be
helpful for those who want to use.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment