db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl ...@apache.org>
Subject Re: please enlighten me... attributes "abstract" and "alias" on tables
Date Wed, 29 Sep 2010 18:38:44 GMT
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: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message