01: /*
02:
03: Derby - Class org.apache.derby.iapi.services.classfile.CONSTANT_Integer_info
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21:
22: package org.apache.derby.iapi.services.classfile;
23:
24: import org.apache.derby.iapi.services.classfile.VMDescriptor;
25: import java.io.IOException;
26:
27: /** Integer Constant - page 96 */
28: class CONSTANT_Integer_info extends ConstantPoolEntry {
29: private final int value;
30:
31: CONSTANT_Integer_info(int value) {
32: super (VMDescriptor.CONSTANT_Integer);
33: this .value = value;
34: }
35:
36: public int hashCode() {
37: return value;
38: }
39:
40: void put(ClassFormatOutput out) throws IOException {
41: super .put(out);
42: out.putU4(value);
43: }
44:
45: public boolean equals(Object other) {
46:
47: // check it is the right type
48: if (other instanceof CONSTANT_Integer_info) {
49:
50: return value == ((CONSTANT_Integer_info) other).value;
51: }
52:
53: return false;
54: }
55:
56: int classFileSize() {
57: // 1 (tag) + 4 (int length)
58: return 1 + 4;
59: }
60: }
|