buf.append("@");
buf.append(Integer.toHexString(hashCode()));
buf.append("[");
- buf.append(Modifier.toString(getModifiers()));
- buf.append(' ');
- buf.append(getName());
extendToString(buf);
buf.append("]");
return buf.toString();
* Implemented in subclasses to add to the {@link #toString()} result.
* Subclasses should put a space before each token added to the buffer.
*/
- abstract protected void extendToString(StringBuffer buffer);
+ protected void extendToString(StringBuffer buffer) {
+ buffer.append(getName());
+ }
/**
* Returns a <code>ClassPool</code> for this class.
protected void extendToString(StringBuffer buffer) {
if (wasChanged)
- buffer.append(" changed");
+ buffer.append("changed ");
if (wasFrozen)
- buffer.append(" frozen");
+ buffer.append("frozen ");
+
+ buffer.append(Modifier.toString(getModifiers()));
+ buffer.append(" class ");
+ buffer.append(getName());
+
+ try {
+ CtClass ext = getSuperclass();
+ if (ext != null) {
+ String name =ext.getName();
+ if (!name.equals("java.lang.Object"))
+ buffer.append(" extends " + ext.getName());
+ }
+ }
+ catch (NotFoundException e) {
+ buffer.append(" extends ??");
+ }
+
+ try {
+ CtClass[] intf = getInterfaces();
+ if (intf.length > 0)
+ buffer.append(" implements ");
+
+ for (int i = 0; i < intf.length; ++i) {
+ buffer.append(intf[i].getName());
+ buffer.append(", ");
+ }
+ }
+ catch (NotFoundException e) {
+ buffer.append(" extends ??");
+ }
CtField field = getFieldsCache();
buffer.append(" fields=");
protected void extendToString(StringBuffer buffer) {
if (hasConstructor)
- buffer.append(" hasConstructor");
+ buffer.append("hasConstructor ");
super.extendToString(buffer);
}
dataSize = size;
}
- protected void extendToString(StringBuffer buffer) {}
-
/**
* Returns <code>true</code> if this object represents a primitive
* Java type: boolean, byte, char, short, int, long, float, double,