You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Jue <te...@gmail.com> on 2008/01/11 23:13:14 UTC

T5 naming and case peculiarities

I wanted to throw together a list of naming peculiarities (I hesitate
to call them pitfalls), to put on the wiki.
Some are documented on the API website, some of these are mailing list
documented, some are only documented if you look into the code.

Use of underscore prefixes for fields, but not in accessors
   Some people just grew into doing it this way.  Eclipse's
getter/setter autogeneration keeps the underscore.

Non case sensitivity of page names in URL
   This is just a nice feature in Tapestry, documented in the code

URL shortening of page names under a similarly named directory.
   A documented feature intended to make things nice for users.
For example:
   A page named "Report" under a directory named "Report" will not resolve.
   A page named "StatusReport" under a directory named "Report" will
resolve to "Status" (i.e. report/status in the url)
   A page named "ReportStatus" under a directory named "Report" will
resolve to "Status" (i.e. report/status in the url)
   A page named "StatusReport1" under a directory named "Report" will
resolve to "StatusReport1" (i.e. report/statusreport1 in the url)

Case sensitivity in @OnEvent and similar annotations
  This is just a Java case sensitivity rule.  Those unfamiliar with
annotations before working with Tapestry (as I was) may forget that
case matters in annotations!  @onEvent is not the same, and your IDE
should tell you this.

Non case sensitive for value of OnEvent
   @OnEvent(value="SUBMIT")
   @OnEvent(value="submit")

Form event methods without annotations:
Besides typos in the name of the method, there is a case sensitivity
issue to be aware of: the "on" prefix must be lower case. i.e.
"OnSubmit" will not get called, but "onSubmit" will. T5's extensive
case insensitivity can cause us to be lazy sometimes.

Tapestry XML DTD's and their keys are case sensitive

Injected Assets are case sensitive
   This is a Servlet API /Java runtime rule.

Names of *.properties files are case sensitive
Names of properties inside the *.properties files are not case sensitive


Are there more?  Does this list sound right?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 naming and case peculiarities

Posted by Andy Huhn <am...@insightbb.com>.
Josh,

I've been looking for that!  Thanks for the tip!

Andy

> This is configurable in Eclipse. Under Window | Preferences look at Java |
> Code Style there is a "Conventions for variable names" section where you can
> tell eclipse what your prefix/suffix preferences are... Then it will make
> nice getter/setter names for you.
> 
> Josh
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 naming and case peculiarities

Posted by Josh Canfield <jo...@thedailytube.com>.
Hey Daniel,


> Use of underscore prefixes for fields, but not in accessors
>   Some people just grew into doing it this way.  Eclipse's
> getter/setter autogeneration keeps the underscore.
>

This is configurable in Eclipse. Under Window | Preferences look at Java |
Code Style there is a "Conventions for variable names" section where you can
tell eclipse what your prefix/suffix preferences are... Then it will make
nice getter/setter names for you.

Josh

On Jan 11, 2008 2:13 PM, Daniel Jue <te...@gmail.com> wrote:

> I wanted to throw together a list of naming peculiarities (I hesitate
> to call them pitfalls), to put on the wiki.
> Some are documented on the API website, some of these are mailing list
> documented, some are only documented if you look into the code.
>
> Use of underscore prefixes for fields, but not in accessors
>   Some people just grew into doing it this way.  Eclipse's
> getter/setter autogeneration keeps the underscore.
>
> Non case sensitivity of page names in URL
>   This is just a nice feature in Tapestry, documented in the code
>
> URL shortening of page names under a similarly named directory.
>   A documented feature intended to make things nice for users.
> For example:
>   A page named "Report" under a directory named "Report" will not resolve.
>   A page named "StatusReport" under a directory named "Report" will
> resolve to "Status" (i.e. report/status in the url)
>   A page named "ReportStatus" under a directory named "Report" will
> resolve to "Status" (i.e. report/status in the url)
>   A page named "StatusReport1" under a directory named "Report" will
> resolve to "StatusReport1" (i.e. report/statusreport1 in the url)
>
> Case sensitivity in @OnEvent and similar annotations
>  This is just a Java case sensitivity rule.  Those unfamiliar with
> annotations before working with Tapestry (as I was) may forget that
> case matters in annotations!  @onEvent is not the same, and your IDE
> should tell you this.
>
> Non case sensitive for value of OnEvent
>   @OnEvent(value="SUBMIT")
>   @OnEvent(value="submit")
>
> Form event methods without annotations:
> Besides typos in the name of the method, there is a case sensitivity
> issue to be aware of: the "on" prefix must be lower case. i.e.
> "OnSubmit" will not get called, but "onSubmit" will. T5's extensive
> case insensitivity can cause us to be lazy sometimes.
>
> Tapestry XML DTD's and their keys are case sensitive
>
> Injected Assets are case sensitive
>   This is a Servlet API /Java runtime rule.
>
> Names of *.properties files are case sensitive
> Names of properties inside the *.properties files are not case sensitive
>
>
> Are there more?  Does this list sound right?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5 naming and case peculiarities

Posted by Andreas Andreou <an...@gmail.com>.
>From my (yet limited) interaction with T5, it sounds quite right...

But let me grab the opportunity and pay my respect to you (and
to a few others fellows - Sven, Davor, e.t.c.) that keep the Tapestry Wiki
so up to date and at such good quality... thx!

On Jan 12, 2008 12:13 AM, Daniel Jue <te...@gmail.com> wrote:
> I wanted to throw together a list of naming peculiarities (I hesitate
> to call them pitfalls), to put on the wiki.
> Some are documented on the API website, some of these are mailing list
> documented, some are only documented if you look into the code.
>
> Use of underscore prefixes for fields, but not in accessors
>    Some people just grew into doing it this way.  Eclipse's
> getter/setter autogeneration keeps the underscore.
>
> Non case sensitivity of page names in URL
>    This is just a nice feature in Tapestry, documented in the code
>
> URL shortening of page names under a similarly named directory.
>    A documented feature intended to make things nice for users.
> For example:
>    A page named "Report" under a directory named "Report" will not resolve.
>    A page named "StatusReport" under a directory named "Report" will
> resolve to "Status" (i.e. report/status in the url)
>    A page named "ReportStatus" under a directory named "Report" will
> resolve to "Status" (i.e. report/status in the url)
>    A page named "StatusReport1" under a directory named "Report" will
> resolve to "StatusReport1" (i.e. report/statusreport1 in the url)
>
> Case sensitivity in @OnEvent and similar annotations
>   This is just a Java case sensitivity rule.  Those unfamiliar with
> annotations before working with Tapestry (as I was) may forget that
> case matters in annotations!  @onEvent is not the same, and your IDE
> should tell you this.
>
> Non case sensitive for value of OnEvent
>    @OnEvent(value="SUBMIT")
>    @OnEvent(value="submit")
>
> Form event methods without annotations:
> Besides typos in the name of the method, there is a case sensitivity
> issue to be aware of: the "on" prefix must be lower case. i.e.
> "OnSubmit" will not get called, but "onSubmit" will. T5's extensive
> case insensitivity can cause us to be lazy sometimes.
>
> Tapestry XML DTD's and their keys are case sensitive
>
> Injected Assets are case sensitive
>    This is a Servlet API /Java runtime rule.
>
> Names of *.properties files are case sensitive
> Names of properties inside the *.properties files are not case sensitive
>
>
> Are there more?  Does this list sound right?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 naming and case peculiarities

Posted by Howard Lewis Ship <hl...@gmail.com>.
Very good research.

On Jan 11, 2008 2:13 PM, Daniel Jue <te...@gmail.com> wrote:
> I wanted to throw together a list of naming peculiarities (I hesitate
> to call them pitfalls), to put on the wiki.
> Some are documented on the API website, some of these are mailing list
> documented, some are only documented if you look into the code.
>
> Use of underscore prefixes for fields, but not in accessors
>    Some people just grew into doing it this way.  Eclipse's
> getter/setter autogeneration keeps the underscore.
>

As you found, Eclipse can adapt to this.  It's not a requirement of
Tapestry, just a coding style.

> Non case sensitivity of page names in URL
>    This is just a nice feature in Tapestry, documented in the code
>
> URL shortening of page names under a similarly named directory.
>    A documented feature intended to make things nice for users.
> For example:
>    A page named "Report" under a directory named "Report" will not resolve.

This should be fixed in 5.0.7, is it not?

>    A page named "StatusReport" under a directory named "Report" will
> resolve to "Status" (i.e. report/status in the url)

To me, this seems sensible.

>    A page named "ReportStatus" under a directory named "Report" will
> resolve to "Status" (i.e. report/status in the url)

Again, seems sensible.

>    A page named "StatusReport1" under a directory named "Report" will
> resolve to "StatusReport1" (i.e. report/statusreport1 in the url)

When a package name is replicated as a prefix or suffix of the
unqualified class name, it is stripped out (unless that would reduce
the name to the empty string).

>
> Case sensitivity in @OnEvent and similar annotations
>   This is just a Java case sensitivity rule.  Those unfamiliar with
> annotations before working with Tapestry (as I was) may forget that
> case matters in annotations!  @onEvent is not the same, and your IDE
> should tell you this.

A concern of the Java compiler, not of Tapestry, of course.

>
> Non case sensitive for value of OnEvent
>    @OnEvent(value="SUBMIT")
>    @OnEvent(value="submit")
>
> Form event methods without annotations:
> Besides typos in the name of the method, there is a case sensitivity
> issue to be aware of: the "on" prefix must be lower case. i.e.
> "OnSubmit" will not get called, but "onSubmit" will. T5's extensive
> case insensitivity can cause us to be lazy sometimes.
>

This could be considered a bug, if you feel it is, submit a bug.

> Tapestry XML DTD's and their keys are case sensitive
>

Again, this is in accord with XML, a concern that goes beyond Tapestry.

> Injected Assets are case sensitive
>    This is a Servlet API /Java runtime rule.

This could be overcome with some effort and expense.

>
> Names of *.properties files are case sensitive


Again, could be overcome with some effort and expense.

> Names of properties inside the *.properties files are not case sensitive

Yes, by intention.

>
>
> Are there more?  Does this list sound right?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org