--- /dev/null
+// MimeTypeAttribute.java\r
+// $Id: MimeTypeAttribute.java,v 1.1 2010/06/15 12:24:16 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1996.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.jigsaw.frames ;\r
+\r
+import org.w3c.tools.resources.Attribute;\r
+import org.w3c.tools.resources.SimpleAttribute;\r
+\r
+import org.w3c.www.mime.MimeType;\r
+import org.w3c.www.mime.MimeTypeFormatException;\r
+\r
+/**\r
+ * The generic class of Mime type attributes.\r
+ */\r
+\r
+public class MimeTypeAttribute extends SimpleAttribute {\r
+\r
+ /**\r
+ * Is the given object a valid MimeTypeAttribute value ?\r
+ * @param obj The object to test.\r
+ * @return A boolean <strong>true</strong> if okay.\r
+ */\r
+\r
+ public boolean checkValue(Object obj) {\r
+ return (obj instanceof MimeType) || (obj == null) ;\r
+ }\r
+\r
+ public String pickle(Object obj) {\r
+ return ((MimeType)obj).toString();\r
+ }\r
+\r
+ public Object unpickle (String value) {\r
+ try {\r
+ return new MimeType(value);\r
+ } catch (MimeTypeFormatException ex) {\r
+ return null;\r
+ }\r
+ }\r
+\r
+ public MimeTypeAttribute(String name, Object def, int flags) {\r
+ super(name, def, flags) ;\r
+ this.type = "org.w3c.www.mime.MimeType".intern();\r
+ }\r
+\r
+ public MimeTypeAttribute() {\r
+ super() ;\r
+ }\r
+}\r