01: // LongAttribute.java
02: // $Id: LongAttribute.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 LongAttribute.
10: */
11:
12: public class LongAttribute extends SimpleAttribute {
13:
14: /**
15: * Is the given object a valid LongAttribute 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 Long) || (obj == null);
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 ((Long) 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 Long.valueOf(value);
41: }
42:
43: public LongAttribute(String name, Long def, int flags) {
44: super (name, def, flags);
45: this .type = "java.lang.Long".intern();
46: }
47:
48: public LongAttribute() {
49: super();
50: }
51:
52: }
|