possibility to set matching pattern
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 26 Dec 2013 17:47:23 +0000 (19:47 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 26 Dec 2013 17:47:23 +0000 (19:47 +0200)
src/main/java/eu/svjatoslav/commons/network/navigation/NavigationItem.java

index d5eeb80..eef52fb 100755 (executable)
@@ -10,7 +10,7 @@ import eu.svjatoslav.commons.string.WildCardMatcher;
 
 public class NavigationItem {
 
-       private final String matchingWildcard;
+       private String matchingPattern;
        private final Map<Locale, String> localeToTitle = new HashMap<Locale, String>();
        ArrayList<NavigationItem> subElements = new ArrayList<NavigationItem>();
        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;
+       }
+
 }