blob: 7f1f90e7c3ce0f61cb79cabfb13c7c029f4893f2 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package com.sun.tools.jdi;
27
28import com.sun.jdi.*;
29
30import java.util.List;
31
32abstract public class TypeComponentImpl extends MirrorImpl
33 implements TypeComponent
34{
35 protected final long ref;
36 protected final String name;
37 protected final String signature;
38 protected final String genericSignature;
39 protected final ReferenceTypeImpl declaringType;
40 private final int modifiers;
41
42 TypeComponentImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
43 long ref,
44 String name, String signature,
45 String genericSignature, int modifiers) {
46 // The generic signature is set when this is created.
47 super(vm);
48 this.declaringType = declaringType;
49 this.ref = ref;
50 this.name = name;
51 this.signature = signature;
52 if (genericSignature != null && genericSignature.length() != 0) {
53 this.genericSignature = genericSignature;
54 } else {
55 this.genericSignature = null;
56 }
57 this.modifiers = modifiers;
58 }
59
60 public String name() {
61 return name;
62 }
63
64 public String signature() {
65 return signature;
66 }
67 public String genericSignature() {
68 return genericSignature;
69 }
70
71 public int modifiers() {
72 return modifiers;
73 }
74
75 public ReferenceType declaringType() {
76 return declaringType;
77 }
78
79 public boolean isStatic() {
80 return isModifierSet(VMModifiers.STATIC);
81 }
82
83 public boolean isFinal() {
84 return isModifierSet(VMModifiers.FINAL);
85 }
86
87 public boolean isPrivate() {
88 return isModifierSet(VMModifiers.PRIVATE);
89 }
90
91 public boolean isPackagePrivate() {
92 return !isModifierSet(VMModifiers.PRIVATE
93 | VMModifiers.PROTECTED
94 | VMModifiers.PUBLIC);
95 }
96
97 public boolean isProtected() {
98 return isModifierSet(VMModifiers.PROTECTED);
99 }
100
101 public boolean isPublic() {
102 return isModifierSet(VMModifiers.PUBLIC);
103 }
104
105 public boolean isSynthetic() {
106 return isModifierSet(VMModifiers.SYNTHETIC);
107 }
108
109 long ref() {
110 return ref;
111 }
112
113 boolean isModifierSet(int compareBits) {
114 return (modifiers & compareBits) != 0;
115 }
116}