W3C home > Mailing lists > Public > www-dom-ts@w3.org > January 2003

Re: accessing outer class variables

From: Curt Arnold <carnold@houston.rr.com>
Date: Sun, 26 Jan 2003 14:46:36 -0600
Message-ID: <3E34492C.907@houston.rr.com>
To: jeroen@x-hive.com, www-dom-ts@w3.org

Jeroen van Rotterdam wrote:
> Hi,
> As a workaround I tried to locally declare variables within the inner
> class by doing:
---- lines omitted
> The problem with this workaround is that the variables that are passed to
> the constructor of the inner class are not properly typed.
>      DOMBuilderFilter myfilter = new DOMBuilderFilterN1E(this, 1, 1, 2, 3 );
> should be:
>      DOMBuilderFilter myfilter = new DOMBuilderFilterN1E(this, (int)1,
> (short)1, (short)2, (short)3 ); >
> Since 1 is by default int.
> Jeroen

That is not a workaround, that was the intended use of that construct. 
They only issue is that I did not anticipate the need to cast integer 
literals to shorts on the constructor.  I'll update the transform.  In 
the interim, if you define the class variables as 'int', you should 
avoid the inner class constructor issue and any casting to short inside 
the inner class body should occur automatically.  Alternatively, you 
could assign literals to test scoped variables before the inner class 
definition and use the test scoped variables as the values for the inner 
class variables.

     <var name="SHOW_ELEMENT" type="int" value="1"/>
     <var name="FILTER_ELEMENT" type="short" value="1"/>
 >   <var name="myfilter"         type="DOMBuilderFilter">
 >      <var name="name"            type="DOMString"/>
 >      <var name='SHOW_ELEMENT'    type='int'    value='SHOW_ELEMENT'/>
 >      <var name='FILTER_ELEMENT'    type='short' 
Received on Sunday, 26 January 2003 15:46:58 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:34:06 UTC