cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <pati_giac...@yahoo.com>
Subject Re: [C2] Sitemap revised again
Date Fri, 30 Jun 2000 08:16:07 GMT

--- Niclas Hedhman <niclas@localbar.com> wrote:
> Giacomo Pati wrote:
> 
> > I'm stumbled over the fact that this Interface didn't show if the matcher was indeed
> successfully
> > matching a given pattern when the pattern does not contain any wildcards:
> 
> At this moment I don't see the implications of your findings, but I take your word for
it.
> 
> >  public interface Matcher implements Component {
> >    public Map match(String pattern, Boolean matched, ...);
> >  }
> 
> Not possible, Boolean is immutable and can not be used as "out" argument.

You convinced me to take a cup of coffee first to get awake :) (my proposal was totally stupid).

> The natural way would be
> 
>  public MatchResult match(String pattern, ...);
> 
> (BTW, what does the ... indicate?? )

It's still not clear what a matcher can match against (uri, user-agent, ...). Maybe the Request
object will be sufficent.

> making MatchResult a concrete non-final class makes it easy to 'enhance' and 'extend'
in the
> future
> without any serious incompatibility issues.
> 
> public class MatchResult
> {
>     private Map matches;
>     private boolean success;
> 
>     // No parameters in constructor
>     // for better future compatibility
>     public MatchResult()
>     {
>     }
> 
>     // protected level protection
>     // also allow package access.
>     // For extended classes outside
>     // the package will be set from
>     // their respective users.
>     protected void setSuccess( boolean s )
>     {
>         this.success = s;
>     }
> 
>     protected void setMatches( Map m )
>     {
>         this.matches = m;
>     }
> 
>     public boolean getSuccess()
>     {
>         return this.success;
>     }
> 
>     public Map getMatches()
>     {
>         return this.matches;
>     }
> }

Yes I think this could be the way to go. We can also supply some utility methods for accessing
the
Map in a XPath fashion.

Thank you, Niclas. This helped very much.

Giacomo


=====
--
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

Mime
View raw message