• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamically loading a class

 
ralph roper
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to pass constructor parameters when dynamically loading a class ? ie Class.forName()
The class I am trying to load is related to a database table. Does anyone know if using JDO is a better alternative to dynamically loading a class ? (.. or am I completely off the track here
?)
 
Steve Deadsea
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the Class.getConstructor(Class[] parameterTypes) method and then get a new instance from that Constructor using Constructor.newInstance(Object[] initargs)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic