users@codemodel.java.net

Re: Create model from source file

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Thu, 13 Dec 2012 19:02:59 +0100

Hi,

> Is it somehow possible to create a JCodeModel (with JDefinedClass objects)
> from existing source code? (Not from compiled *.class files, but from *.java
> files.)
>
> Any help is appreciated! :-)

You'll need to parse the Java code and to create the JCodeModel
objects from what you've parsed. There are a lot of parsers which can
handle Java code, for example: http://code.google.com/p/javaparser/.

However the task of creating the JCodeModel might be too big. Maybe
you'll be satisfied with what javaParser produces.

Bye,
/lexi