diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2012-06-17 15:01:27 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2012-06-17 15:01:27 +0000 |
commit | e2cfbeaed7be298c93251f6f9af480cdba84f68f (patch) | |
tree | 8b49af3c3a31cde77e252c5327900fbb0d628505 /src/main/javassist/CtField.java | |
parent | 08deb0e6bc17f84f6bda03a29a7c2d3a8610a1ef (diff) | |
download | javassist-e2cfbeaed7be298c93251f6f9af480cdba84f68f.tar.gz javassist-e2cfbeaed7be298c93251f6f9af480cdba84f68f.zip |
implemented JASSIST-170
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@639 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/CtField.java')
-rw-r--r-- | src/main/javassist/CtField.java | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/main/javassist/CtField.java b/src/main/javassist/CtField.java index a16e1396..16e450bf 100644 --- a/src/main/javassist/CtField.java +++ b/src/main/javassist/CtField.java @@ -327,20 +327,44 @@ public class CtField extends CtMember { * * <p>Note that the returned string is not the type signature * contained in the <code>SignatureAttirbute</code>. It is - * a descriptor. To obtain a type signature, call the following - * methods: - * - * <ul><pre>getFieldInfo().getAttribute(SignatureAttribute.tag) - * </pre></ul> + * a descriptor. * * @see javassist.bytecode.Descriptor - * @see javassist.bytecode.SignatureAttribute + * @see #getGenericSignature() */ public String getSignature() { return fieldInfo.getDescriptor(); } /** + * Returns the generic signature of the field. + * It represents a type including type variables. + * + * @see SignatureAttribute#toFieldSignature(String) + * @since 3.17 + */ + public String getGenericSignature() { + SignatureAttribute sa + = (SignatureAttribute)fieldInfo.getAttribute(SignatureAttribute.tag); + return sa == null ? null : sa.getSignature(); + } + + /** + * Set the generic signature of the field. + * It represents a type including type variables. + * See {@link javassist.CtClass#setGenericSignature(String)} + * for a code sample. + * + * @param sig a new generic signature. + * @see javassist.bytecode.SignatureAttribute.ObjectType#encode() + * @since 3.17 + */ + public void setGenericSignature(String sig) { + declaringClass.checkModify(); + fieldInfo.addAttribute(new SignatureAttribute(fieldInfo.getConstPool(), sig)); + } + + /** * Returns the type of the field. */ public CtClass getType() throws NotFoundException { |