[android-developers] Re: Java Question about reflection

2010-01-04 Thread jotobjects
On Jan 2, 5:02 pm, Frank Weiss fewe...@gmail.com wrote: For your first issue, can you refactor to use singleton Factory instead and make the factory methods non-static? Example: MyFactory factory = MySubclassedFactory.getInstance(); MyWidget = factory.createMyWidget(); This and the Builder

Re: [android-developers] Re: Java Question about reflection

2010-01-03 Thread Attila Bodis
Consider using the builder pattern instead of static factory methods: http://en.wikipedia.org/wiki/Builder_pattern On Sat, Jan 2, 2010 at 2:58 PM, jotobjects jotobje...@gmail.com wrote: Here is a start... Class barClass = com.example.Bar.class; Method m = barClass.getMethod(foo, ...) // add

[android-developers] Re: Java Question about reflection

2010-01-02 Thread jotobjects
Here is a start... Class barClass = com.example.Bar.class; Method m = barClass.getMethod(foo, ...) // add parameter types to call Object val = m.invoke(null, ...) // add parameter values to call On Jan 2, 12:10 pm, Philip philip.dese...@gmail.com wrote: 2. I am trying to replicate the easy

Re: [android-developers] Re: Java Question about reflection

2010-01-02 Thread Frank Weiss
For your first issue, can you refactor to use singleton Factory instead and make the factory methods non-static? Example: MyFactory factory = MySubclassedFactory.getInstance(); MyWidget = factory.createMyWidget(); Then the createMyWidget method (possibly abstract in MyFactory) can be overridde