No, I know - but that isn't what I was saying.  Code that is
compiled against JSF 1.1 will simply have ":" inlined,
and will not re-consult the value in NamingContainer.
This technique would only work if you got people to
recompile against JSF 1.2.

And people are going to be compiling against 1.1 for a
long time.

-- Adam


On 4/20/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > You'd still have to recompile all code to take advantage of that.
>
> Er, no you don't. The value of the constant is only set when the class is
> loaded. It will use the current value of the system property, which gets
> set when the JVM is initialized, i.e. before any classes get loaded.
> Anything that was compiled to that constant will use the value of the
> constant as defined when the class is loaded. It is a hack, but it avoids
> changing the API...
>
> For example:
>
> public interface MySysProps {
>       String CONST = System.getProperty("myprop", "default");
> }
>
> public class SysPropsTest {
>       public static void main(String[] args) {
>             System.out.println("Value of constant: " + MySysProps.CONST);
>       }
> }
>
> Output:
>
> C:\>java SysPropsTest
> Value of constant: default
>
> // no need to recompile, just run with a new value:
>
> C:\>java -Dmyprop=foobar SysPropsTest
> Value of constant: foobar
>
> --
> Colin Sharples
>
>
> CAUTION - This message may contain privileged and confidential information 
> intended only for the use of the addressee named above. If you are not the 
> intended recipient of this message you are hereby notified that any use, 
> dissemination, distribution or reproduction of this message is prohibited. If 
> you have received this message in error please notify Bank of New Zealand 
> immediately. Any views expressed in this message are those of the individual 
> sender and may not necessarily reflect the views of Bank of New Zealand.
>

Reply via email to