On 27.09.10 21:43, Thomas Fischer wrote:
> You cannot override a static method. Ecample:
>
> // Base.java
> public class Base
> {
> public static String getOmClass()
> {
> return "BASE";
> }
>
> public static void printOmClass()
> {
> System.out.println(getOmClass());
The example is System.out.println(Inherited.getOmClass()) here.
> }
> }
>
> // Inherited.java
> public class Inherited extends Base
> {
> public static String getOmClass()
> {
> return "INHERITED";
> }
>
> public static void main(String[] argv)
> {
> printOmClass();
> }
> }
> Or did I musunderstand what you were saying ?
Probably. What happens in our case is that the call always goes to
TablePeer.getOMClass(). If that does not exist,
BaseTablePeer.getOMClass() gets called. If this didn't work, we could
never use TablePeer.doSelect() because the method is in fact in
BaseTablePeer. If you add a static method getOMClass() to TablePeer,
this will get called. This is not exactly an "override" but works as
such. Torque has many places where this behavior is employed.
> Go ahead, should not be difficult to implement. I can help, if you have any
> questions.
Well, I'd rather concentrate myself on the runtime... :-)
Bye, Thomas.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]