From: Svjatoslav Agejenko Date: Thu, 26 Dec 2013 17:47:23 +0000 (+0200) Subject: possibility to set matching pattern X-Git-Tag: svjatoslavcommons-1.8~112 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=a1959a0ecf6a3cb60687b6eb3b1be62466b77c65;p=svjatoslav_commons.git possibility to set matching pattern --- diff --git a/src/main/java/eu/svjatoslav/commons/network/navigation/NavigationItem.java b/src/main/java/eu/svjatoslav/commons/network/navigation/NavigationItem.java index d5eeb80..eef52fb 100755 --- a/src/main/java/eu/svjatoslav/commons/network/navigation/NavigationItem.java +++ b/src/main/java/eu/svjatoslav/commons/network/navigation/NavigationItem.java @@ -10,7 +10,7 @@ import eu.svjatoslav.commons.string.WildCardMatcher; public class NavigationItem { - private final String matchingWildcard; + private String matchingPattern; private final Map localeToTitle = new HashMap(); ArrayList subElements = new ArrayList(); private Locale[] localeOrder; @@ -23,7 +23,7 @@ public class NavigationItem { public NavigationItem(final Locale... localeOrder) { this.localeOrder = localeOrder; - matchingWildcard = null; + matchingPattern = null; linkUrl = null; } @@ -31,7 +31,7 @@ public class NavigationItem { final String... titles) { this.parent = parent; this.linkUrl = linkUrl; - matchingWildcard = linkUrl; + matchingPattern = linkUrl; initializeLocalizedTitles(titles); } @@ -81,8 +81,13 @@ public class NavigationItem { } public boolean matchesUrl(final String url) { - return WildCardMatcher.match(url, matchingWildcard); + return WildCardMatcher.match(url, matchingPattern); } + public NavigationItem setPattern(final String pattern) { + matchingPattern = pattern; + return this; + } + }