001: /*******************************************************************************
002: * Copyright (c) 2000, 2005 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdi.internal;
011:
012: import com.sun.jdi.ReferenceType;
013: import com.sun.jdi.TypeComponent;
014:
015: /**
016: * this class implements the corresponding interfaces
017: * declared by the JDI specification. See the com.sun.jdi package
018: * for more information.
019: *
020: */
021: public abstract class TypeComponentImpl extends AccessibleImpl
022: implements TypeComponent {
023: /** Text representation of this type. */
024: private String fName = null;
025: /** JNI-style signature for this type. */
026: private String fSignature = null;
027: /** the generic signature for this type, java 1.5 */
028: private String fGenericSignature;
029: /** ReferenceType that holds field or method. */
030: private ReferenceTypeImpl fDeclaringType;
031: /** Modifier bits. */
032: protected int fModifierBits;
033:
034: /**
035: * Creates new instance.
036: */
037: public TypeComponentImpl(String description,
038: VirtualMachineImpl vmImpl, ReferenceTypeImpl declaringType,
039: String name, String signature, String genericSignature,
040: int modifierBits) {
041: super (description, vmImpl);
042: fName = name;
043: fSignature = signature;
044: fGenericSignature = genericSignature;
045: fDeclaringType = declaringType;
046: fModifierBits = modifierBits;
047: }
048:
049: /**
050: * @return Returns modifier bits.
051: */
052: public int modifiers() {
053: return fModifierBits;
054: }
055:
056: /**
057: * @return Returns the ReferenceTypeImpl in which this component was declared.
058: */
059: public ReferenceTypeImpl referenceTypeImpl() {
060: return fDeclaringType;
061: }
062:
063: /**
064: * @return Returns the type in which this component was declared.
065: */
066: public ReferenceType declaringType() {
067: return fDeclaringType;
068: }
069:
070: /**
071: * @return Returns true if type component is final.
072: */
073: public boolean isFinal() {
074: return (fModifierBits & MODIFIER_ACC_FINAL) != 0;
075: }
076:
077: /**
078: * @return Returns true if type component is static.
079: */
080: public boolean isStatic() {
081: return (fModifierBits & MODIFIER_ACC_STATIC) != 0;
082: }
083:
084: /**
085: * @return Returns true if type component is synthetic.
086: */
087: public boolean isSynthetic() {
088: return (fModifierBits & (MODIFIER_SYNTHETIC | MODIFIER_ACC_SYNTHETIC)) != 0;
089: }
090:
091: /**
092: * @return Returns text representation of this type.
093: */
094: public String name() {
095: return fName;
096: }
097:
098: /**
099: * @return JNI-style signature for this type.
100: */
101: public String signature() {
102: return fSignature;
103: }
104:
105: /**
106: * @return Returns description of Mirror object.
107: */
108: public String toString() {
109: return fName;
110: }
111:
112: public String genericSignature() {
113: return fGenericSignature;
114: }
115:
116: }
|