Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

why ** is slightly different between Ant and Java 7

 
author & internet detective
Posts: 40796
828
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code and scenario are here

It ends with:

The Ant approach probably feels more natural to me because I’ve been using it longer. But the Java approach seems more logical because it doesn’t have the extra slash that doesn’t actually get matched.



Which approach do you find more natural? I suspect the Java once, but I'd like to see if that reality matches for someone who hasn't used Ant.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like the Ant one, but like you I have used so many frameworks that have adapted the Ant style pattern matching that I am probably just used to it.
 
Jeanne Boyarsky
author & internet detective
Posts: 40796
828
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bill Gorder wrote:I like the Ant one, but like you I have used so many frameworks that have adapted the Ant style pattern matching that I am probably just used to it.


Interesting. Can you give an example of a framework that uses the Ant style? I wasn't aware it was adopted elsewhere. (it isn't surprising though)
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The most notable one is Spring, and of course Spring Security (and Acegi before that). Apache Shiro (another Security framework) also uses ant style pattern/path matching.

http://docs.spring.io/spring-security/site/docs/3.2.0.RELEASE/apidocs/org/springframework/security/web/util/AntPathRequestMatcher.html
http://docs.spring.io/spring/docs/3.1.4.RELEASE/javadoc-api/org/springframework/util/AntPathMatcher.html
http://docs.spring.io/spring/docs/2.5.6/api/org/springframework/core/io/support/PathMatchingResourcePatternResolver.html

To name a few of the classes.
 
Jeanne Boyarsky
author & internet detective
Posts: 40796
828
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course. I've even used that feature in Spring. I didn't notice the style of ** because I just assumed it always worked that way! Thanks for reminding.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic