This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Generating arbitrary Java classes at run time with Kawa


Hi Per,

thank you for the quick reply. Unfortunately, anonymous classes is not what I need. My goal is to produce a set of ~150 Java classes (in the form of class files or a JAR). These classes shall be annotated POJOs to form Hibernate interface to a legacy DB. These classes are to be used in systems which do not include Kawa runtime. So for this very task I plan to use Kawa as a developer tool only.

Do you think that is possible?

Regards,
Vladimir

09.11.2012 01:37, Per Bothner wrote:
On 11/08/2012 01:24 PM, Per Bothner wrote:
On 11/08/2012 01:11 PM, Vladimir Tsichevski wrote:
Hi all,

is is possible to use Kawa to generate Java classes based on run time
information (not known at compile time)?

The problem is that define-simple-class is a syntax, not a function.

I know, at run time I could convert my Java class metadata to a scheme
file with all define-simple-class expressions, and then compile the
file, but I'm looking for more elegant solution.

You should be able to use the eval function.

You might also consider using the object syntax, rather than define-simple-class, assuming a singleton class (single-instance) is enough: http://www.gnu.org/software/kawa/Anonymous-classes.html

(define my-object (eval `(object (,base-class) ,@(calculated-stuff))))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]