* class file. Those interested in programatically generating classes
* should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
- * @version $Id: JavaClass.java,v 1.4 2005/06/26 20:27:40 acolyer Exp $
+ * @version $Id: JavaClass.java,v 1.5 2005/07/08 10:19:14 acolyer Exp $
* @see org.aspectj.apache.bcel.generic.ClassGen
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
// state for dealing with generic signature string
private String signatureAttributeString = null;
+ private Signature signatureAttribute = null;
private boolean searchedForSignatureAttribute = false;
/**
* Coded for performance - searches for the attribute only when requested - only searches for it once.
*/
public final String getGenericSignature() {
+ loadGenericSignatureInfoIfNecessary();
+ return signatureAttributeString;
+ }
+
+private void loadGenericSignatureInfoIfNecessary() {
if (!searchedForSignatureAttribute) {
boolean found=false;
for(int i=0; !found && i < attributes.length; i++) {
if(attributes[i] instanceof Signature) {
- signatureAttributeString = ((Signature)attributes[i]).getSignature();
+ signatureAttribute = ((Signature)attributes[i]);
+ signatureAttributeString = signatureAttribute.getSignature();
found=true;
}
}
searchedForSignatureAttribute=true;
}
- return signatureAttributeString;
+}
+
+ /**
+ * the parsed version of the above
+ */
+ public final Signature.ClassSignature getGenericClassTypeSignature() {
+ loadGenericSignatureInfoIfNecessary();
+ if (signatureAttribute != null) {
+ return signatureAttribute.asClassSignature();
+ } else {
+ return null;
+ }
}
}