01: // BooleanAttribute.java
02: // $Id: BooleanAttribute.java,v 1.5 2002/06/09 10:14:29 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 BooleanAttribute.
10: */
11:
12: public class BooleanAttribute extends SimpleAttribute {
13:
14: /**
15: * Is the given object a valid BooleanAttribute value ?
16: * @param obj The object to test.
17: * @return A boolean <strong>true</strong> if okay.
18: */
19:
20: public boolean checkValue(Object obj) {
21: return (obj instanceof Boolean);
22: }
23:
24: /**
25: * Pickle an integer to the given output stream.
26: * @param obj The object to pickle.
27: */
28:
29: public String pickle(Object obj) {
30: return ((Boolean) obj).toString();
31: }
32:
33: /**
34: * Unpickle an integer from the given input stream.
35: * @param value the string representation of this integer
36: * @return An instance of Integer.
37: */
38:
39: public Object unpickle(String value) {
40: return Boolean.valueOf(value);
41: }
42:
43: public BooleanAttribute(String name, Boolean def, int flags) {
44: super (name, def, flags);
45: this .type = "java.lang.Boolean".intern();
46: }
47:
48: public BooleanAttribute() {
49: super();
50: }
51:
52: }
|