01: // StringAttribute.java
02: // $Id: StringAttribute.java,v 1.5 2002/06/09 09:50:06 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1996.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.tools.resources;
07:
08: /**
09: * The generic description of an StringAttribute.
10: */
11:
12: public class StringAttribute extends SimpleAttribute {
13:
14: /**
15: * Is the given object a valid StringAttribute value ?
16: * @param obj The object to test.
17: * @return A boolean <strong>true</strong> if value is valid.
18: */
19:
20: public boolean checkValue(Object obj) {
21: return (obj instanceof String) || (obj == null);
22: }
23:
24: public String pickle(Object obj) {
25: return (String) obj;
26: }
27:
28: public Object unpickle(String value) {
29: return value;
30: }
31:
32: /**
33: * Create a description for a generic String attribute.
34: * @param name The attribute name.
35: * @param def The default value for these attributes.
36: * @param flags The associated flags.
37: */
38:
39: public StringAttribute(String name, String def, int flags) {
40: super (name, def, flags);
41: this .type = "java.lang.String".intern();
42: }
43:
44: public StringAttribute() {
45: super();
46: }
47: }
|