[jboss-user] [Javassist user questions] - how to annotate a field

Ugn do-not-reply at jboss.com
Mon May 5 11:22:38 EDT 2008

Firstly hello everybody!
I am very new to javassist and am trying to write a  class / function, which implements an interface which is passed to it.
So its something like 
MyInterfac p = ImplFactory.implement(MyInterface.class);

What i need is to annotate the field of the implemented class with annotations, which i  have read from the interface.
public interface PersonTestInterface {
	public static final String foaf = "http://xmlns.com/foaf/0.1/";
	 @rdf(foaf+"surname") <-----take this
	 public Collection getSurnames();

should be implemented as:

public class PersonTestInterfaceImpl
    implements PersonTestInterface
    @rdf(foaf+"surname") <---- put it here
    private Collection surnames;
    public Collection getSurnames()
        return surnames;
Could someone help me and tell how to create the annotations on the fields? The easiest way would be somethink to "copy" the annotations.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148638#4148638

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148638

More information about the jboss-user mailing list