Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.2
    • Component/s: Converters
    • Labels:
      None

      Description

      FontConverter. The jvm is throwing errors (outside the jvm errors) when converting sometimes.

      This class is perfect for my situation, but probably not others: (and it's a super hack )

      import java.awt.*;

      import com.thoughtworks.xstream.converters.basic.*;

      public class FontConverter extends AbstractBasicConverter {

      public boolean canConvert(Class type)

      { return type.equals(Font.class); }

      protected Object fromString(String str)

      { String[] split = str.split(","); return new Font(split[0], Integer.parseInt(split[1]), Integer.parseInt(split[2])); }

      protected String toString(Object obj)

      { Font font = (Font)obj; return font.getName()+","+font.getStyle()+","+font.getSize(); }

      }

        People

        • Assignee:
          Unassigned
          Reporter:
          Joe Walnes
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: