A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Creating Java classes on fly
Joined: Feb 26, 2006
Jul 15, 2009 09:33:43
Can any one tell me how can I create
classes on the fly.
Like if I provide name of the java class(fully qualified), with specification of its methods and fields how can I create java classes on fly.
Do I need some Byte code engg. or I can do it with Plane reflection
Joined: Mar 22, 2005
Jul 15, 2009 09:49:26
Reflection only works on existing objects (and hence, classes). But you can construct classes from source code at runtime using a library like Javassist.
I wrote for the JavaRanch Journal explains how it's done.
It is sorta covered in the
JavaRanch Style Guide
subject: Creating Java classes on fly
dynamic proxy creation
how to perform query on multiple tables dynamically? tables that has no mapped entity
Creating a Class on-the-fly
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015