logo       

[xstream-dev] [jira] Closed: (XSTR-95) Converter for java.awt.Font: msg#00008

java.xstream.devel

Subject: [xstream-dev] [jira] Closed: (XSTR-95) Converter for java.awt.Font

Message:

The following issue has been closed.

---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/browse/XSTR-95

Here is an overview of the issue:
---------------------------------------------------------------------
Key: XSTR-95
Summary: Converter for java.awt.Font
Type: Improvement

Status: Closed
Priority: Major
Resolution: FIXED

Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown

Project: XStream
Components:
Converters
Fix Fors:
1.0.2

Assignee:
Reporter: Joe Walnes

Created: Mon, 28 Jun 2004 12:31 PM
Updated: Tue, 20 Jul 2004 8:22 AM

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 :P )

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();
}

}



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise