/** * Returns a new content type-based navigation key. * @param contentType Content type. * @return The requested key. */ public static NavigationKey contentType(final ContentType contentType) { return new NavigationKey(null, null, contentType); }
/** * Returns a new tag-based navigation key. * @param tag Tag. * @param contentType Content type. * @return The requested key. */ public static NavigationKey tag(final String tag, final ContentType contentType) { return new NavigationKey(null, checkNotNull(tag), contentType); }
/** * Returns a new category-based navigation key. * @param category Category. * @param contentType Content type. * @return The requested key. */ public static NavigationKey category(final Category category, final ContentType contentType) { return new NavigationKey(checkNotNull(category), null, contentType); }
public NavigationKey withContentType(ContentType contentType) { Preconditions.checkNotNull(contentType); return new NavigationKey(category, tag, contentType); }
public NavigationKey withoutContentType() { if (!isContentType()) { return this; } if (category == null && tag == null) { return null; } return new NavigationKey(category, tag, null); }