View Javadoc

1   package serp.bytecode;
2   
3   import java.util.*;
4   
5   import serp.bytecode.lowlevel.*;
6   
7   /***
8    * State implementing the behavior of a primitive class.
9    *
10   * @author Abe White
11   */
12  class PrimitiveState extends State {
13      private final Class _type;
14      private final NameCache _names;
15  
16      public PrimitiveState(Class type, NameCache names) {
17          _type = type;
18          _names = names;
19      }
20  
21      public int getMagic() {
22          return Constants.VALID_MAGIC;
23      }
24  
25      public int getMajorVersion() {
26          return Constants.MAJOR_VERSION;
27      }
28  
29      public int getMinorVersion() {
30          return Constants.MINOR_VERSION;
31      }
32  
33      public int getAccessFlags() {
34          return Constants.ACCESS_PUBLIC | Constants.ACCESS_FINAL;
35      }
36  
37      public int getIndex() {
38          return 0;
39      }
40  
41      public int getSuperclassIndex() {
42          return 0;
43      }
44  
45      public List getInterfacesHolder() {
46          return Collections.EMPTY_LIST;
47      }
48  
49      public List getFieldsHolder() {
50          return Collections.EMPTY_LIST;
51      }
52  
53      public List getMethodsHolder() {
54          return Collections.EMPTY_LIST;
55      }
56  
57      public Collection getAttributesHolder() {
58          return Collections.EMPTY_LIST;
59      }
60  
61      public String getName() {
62          return _names.getExternalForm(_type.getName(), false);
63      }
64  
65      public String getSuperclassName() {
66          return null;
67      }
68  
69      public String getComponentName() {
70          return null;
71      }
72  
73      public boolean isPrimitive() {
74          return true;
75      }
76  
77      public boolean isArray() {
78          return false;
79      }
80  }