Re: Q: Pattern for this?



Assuming you pass the parser some information about the names of the columns, this looks like a job for JavaBeans and reflection. With JavaBeans you use conventions to indicate properties of your classes and use reflection to dynamically access the properties at runtime.

Is that to say, I can create fields and accessors dynamically? I only thought reflection is about "looking in at yourself" and only be able to get a discription and access existing object, not create these.


/Casper
.



Relevant Pages

  • Re: Q: Pattern for this?
    ... With JavaBeans you use conventions to indicate properties of your classes and use reflection to dynamically access the properties at runtime. ...
    (comp.lang.java)
  • Re: Q: Pattern for this?
    ... such that I can also parse other files which records do not conform to the accessors above. ... I particulary wonder about letting each Record implement different accessor interfaces, but this gives me nothing but ClassCastExceptions. ... With JavaBeans you use conventions to indicate properties of your classes and use reflection to dynamically access the properties at runtime. ...
    (comp.lang.java)