ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert K Casto" <>
Subject RE: [cinjug] Get class name in static context
Date Fri, 23 Mar 2001 21:51:44 GMT
I think your best bet is to declare a static method
inside the class that returns a string. Subclasses
can override this static method so that you have the
right string coming back depending on which class
you are using. Because the method is static and the
value returned in the method is static, it should
work and be setup at compile time. If this is still
too late for what you want to do, then I don't have
any ideas that could help you.

Robert Casto

-----Original Message-----
From: []On
Behalf Of Mills, Maurice
Sent: Friday, March 23, 2001 4:16 PM
To: ''; Ant-User (E-mail); Jboss (E-mail)
Subject: [cinjug] Get class name in static context

Sorry, to the Ant and JBoss lists, but the response is quicker from you.

I am trying to get the name of a class during static initialization.
Normally, you do this.getClass().getName(), however getClass() is not static
and therefore can not be called from a method, or initialization.

Does anyone know how to do this?
To find out more about this mailing list including how to unsubscribe,
send the message "info cinjug" to

View raw message