cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <>
Subject Re: [C2] Sitemap revised again
Date Fri, 30 Jun 2000 06:58:29 GMT
Giacomo Pati wrote:

> I'm stumbled over the fact that this Interface didn't show if the matcher was indeed
> 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.

> or exchange Map and boolean to
>  public interface Matcher implements Component {
>    public boolean match(HashMap map, String pattern, ...);
>  }

Not very clean...

> where the SitemapProcessor supplies the Map and we have the Matcher to supports a specific
> like the HashMap supposed above. This design support the possibility to put unused Maps
into a
> pool for later use to eliminate some GC and instantiation overhead in favor to the matcher.clean()
> method.
> What is your oppinion to this?

The natural way would be

 public MatchResult match(String pattern, ...);

(BTW, what does the ... indicate?? )

making MatchResult a concrete non-final class makes it easy to 'enhance' and 'extend' in the
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;


View raw message