Groups
Groups
Sign in
Groups
Groups
JavaParser
Conversations
About
Send feedback
Help
Extend A Class (Inherit From A New Class Using JavaParser)
189 views
Skip to first unread message
Adeel Iqbal
unread,
Jan 18, 2013, 11:21:26 AM
1/18/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javap...@googlegroups.com
how to extend a class using javaparser.
e.g. i have a class name
MyClass
and i have to extend it from
Threads class
.
i.e.
public class
MyClass
{ ----
}
and i want the final output as
public class
MyClass extends Threads
{ ---
}
Ahti Legonkov
unread,
Jan 18, 2013, 11:41:15 AM
1/18/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javap...@googlegroups.com
In your visitor when you visit a
ClassOrInterfaceDeclaration
, use setExtends method to set the list of classes that the class extends.
@Override
void visit(ClassOrInterfaceDeclaration decl)
{
// Make class extend Blah.
decl.setExtends(new List(new
ClassOrInterfaceType("Blah")));
}
--
lego
Adeel Iqbal
unread,
Jan 18, 2013, 1:32:25 PM
1/18/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javap...@googlegroups.com
thanks for your support. it helped a lot
Adeel Iqbal
unread,
Jan 18, 2013, 1:33:23 PM
1/18/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javap...@googlegroups.com
i have not used the visit method. but using the ClassOrInterfaceDeclaration. i have extended my class.
Reply all
Reply to author
Forward
0 new messages