1
|
package jdeserialize;
|
2
|
|
3
|
import java.util.Map;
|
4
|
|
5
|
/**
|
6
|
* <p>
|
7
|
* Represents an enum instance. As noted in the serialization spec, this
|
8
|
* consists of merely the class description (represented by a classdesc) and the
|
9
|
* string corresponding to the enum's value. No other fields are ever
|
10
|
* serialized.
|
11
|
* </p>
|
12
|
*/
|
13
|
public class enumobj extends contentbase {
|
14
|
/**
|
15
|
* The enum's class description.
|
16
|
*/
|
17
|
public classdesc classdesc;
|
18
|
|
19
|
/**
|
20
|
* The string that represents the enum's value.
|
21
|
*/
|
22
|
public stringobj value;
|
23
|
|
24
|
/**
|
25
|
* Constructor.
|
26
|
*
|
27
|
* @param handle the enum's handle
|
28
|
* @param cd the enum's class description
|
29
|
* @param so the enum's value
|
30
|
*/
|
31
|
public enumobj(int handle, classdesc cd, stringobj so) {
|
32
|
super(contenttype.ENUM);
|
33
|
this.handle = handle;
|
34
|
this.classdesc = cd;
|
35
|
this.value = so;
|
36
|
}
|
37
|
public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting) {
|
38
|
return this.value.value;
|
39
|
}
|
40
|
|
41
|
public String toString(){
|
42
|
return "[enum " + jdeserialize.hex(handle) + ": " + value.value + "]";
|
43
|
}
|
44
|
}
|