From a1959a0ecf6a3cb60687b6eb3b1be62466b77c65 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Thu, 26 Dec 2013 19:47:23 +0200 Subject: [PATCH] possibility to set matching pattern --- .../commons/network/navigation/NavigationItem.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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; + } + } -- 2.20.1