/[cashew-s-editor]/cashews/src/nongnu/cashews/xml/Serializer.java
ViewVC logotype

Diff of /cashews/src/nongnu/cashews/xml/Serializer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by gnu_andrew, Mon May 9 02:36:56 2005 UTC revision 1.6 by gnu_andrew, Thu May 19 10:51:49 2005 UTC
# Line 339  public class Serializer Line 339  public class Serializer
339     * @param objRoot the root to which the serialized document should be     * @param objRoot the root to which the serialized document should be
340     *                presented.     *                presented.
341     */     */
342    public static void serializeValue(String name, Object value,    public static <T>void serializeValue(String name, T value,
343                                      TypeMapper mapper, Document document,                                         TypeMapper mapper, Document document,
344                                      Element objRoot)                                         Element objRoot)
345      throws IllegalAccessException      throws IllegalAccessException
346    {    {
347      serializeValue(name, value, false, true, mapper, document, objRoot);      serializeValue(name, value, false, true, mapper, document, objRoot);
# Line 361  public class Serializer Line 361  public class Serializer
361     * @param objRoot the root to which the serialized document should be     * @param objRoot the root to which the serialized document should be
362     *                presented.     *                presented.
363     */     */
364    public static void serializeValue(String name, Object value,    public static <T> void serializeValue(String name, T value,
365                                      boolean includeFieldName,                                          boolean includeFieldName,
366                                      boolean includeTypeName,                                          boolean includeTypeName,
367                                      TypeMapper mapper, Document document,                                          TypeMapper mapper, Document document,
368                                      Element objRoot)                                          Element objRoot)
369      throws IllegalAccessException      throws IllegalAccessException
370    {    {
371      System.out.println("field: " + name);      System.out.println("field: " + name);
372      if (value == null)      if (value == null)
373        return;        return;
374      Class valueClazz = value.getClass();      Class<T> valueClazz = (Class<T>) value.getClass();
375      System.out.println("value: " + value + ", " + valueClazz);      System.out.println("value: " + value + ", " + valueClazz);
376      XsdType schemaType = mapper.map(valueClazz);      XsdType<T> schemaType = mapper.map(valueClazz);
377      if (schemaType != null)      if (schemaType != null)
378        {        {
379          Element element = createElement(document, name);          Element element = createElement(document, name);

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26