import eu.svjatoslav.commons.network.Locale;
import eu.svjatoslav.commons.string.WildCardMatcher;
-public class NavigationItem<NI extends NavigationItem> {
+public class NavigationItem {
private String matchingPattern;
private final Map<Locale, String> localeToTitle = new HashMap<Locale, String>();
- private final ArrayList<NI> subElements = new ArrayList<NI>();
- private final NI parent;
- private final Navigation<NI> navigation;
+ private final ArrayList<NavigationItem> subElements = new ArrayList<NavigationItem>();
+ private final NavigationItem parent;
+ private final Navigation<NavigationItem> navigation;
private final String linkUrl;
/**
* CSS prefix is inherited to child menu items.
*/
private String cssPrefix;
- public NavigationItem(final Navigation<NI> navigation) {
+ public NavigationItem(final Navigation<NavigationItem> navigation) {
this.navigation = navigation;
parent = null;
matchingPattern = null;
linkUrl = null;
}
- public NavigationItem(final NI parent, final String linkUrl,
+ public NavigationItem(final NavigationItem parent, final String linkUrl,
final String... titles) {
- this.navigation = parent.getNavigation();
+ navigation = parent.getNavigation();
this.parent = parent;
this.linkUrl = linkUrl;
matchingPattern = linkUrl;
parent.addNavigationItem(this);
}
- public void addNavigationItem(final NI navigationItem) {
+ public void addNavigationItem(final NavigationItem navigationItem) {
subElements.add(navigationItem);
}
return linkUrl;
}
- NI getMatchingNavigationItem(final String requestPath) {
+ NavigationItem getMatchingNavigationItem(final String requestPath) {
if (matchesUrl(requestPath))
- return (NI) this;
+ return this;
- for (final NI childNavigationItem : subElements) {
- final NI match = (NI) childNavigationItem
+ for (final NavigationItem childNavigationItem : subElements) {
+ final NavigationItem match = childNavigationItem
.getMatchingNavigationItem(requestPath);
if (match != null)
return null;
}
- public Navigation<NI> getNavigation() {
+ public Navigation<NavigationItem> getNavigation() {
return navigation;
}
- public List<NI> getSubElements() {
+ public List<NavigationItem> getSubElements() {
return subElements;
}