T - the type of thing.public abstract class SCMCategory<T> extends Object
A rose by any other name would smell as sweet?Naming things is hard. Naming things related to a source control system is even harder. It would be really nice if all the source control systems could agree on a standard set or terminologies for how to name things to do with source control systems. You are reading this and thinking "but how bad can it be?":
trunk / branches/___ / tags/___ structure for
each project.
So, if following conventions you might have "commits"; "trunk", "branches" and "tags"; "projects" or "repositories"; and "repositories" or "servers"
For example:
SCMHead discovered by its SCMSource. It might return "Repositories" and "Forks" as the
different types of project discovered by its SCMNavigator.
SCMHeadCategory is used to categorize SCMHead instances returned by a SCMSourceSCMSourceCategory is used to categorize SCMSource instances returned by a
SCMNavigator| Constructor and Description |
|---|
SCMCategory(org.jvnet.localizer.Localizable displayName)
Constructs an uncategorized category with the specified display name.
|
SCMCategory(String name,
org.jvnet.localizer.Localizable displayName)
Constructs a named category with the specified display name.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract org.jvnet.localizer.Localizable |
defaultDisplayName()
The default display name.
|
org.jvnet.localizer.Localizable |
getDisplayName()
Get the term used in the UI to represent a collection of things in this kind of
SCMCategory. |
String |
getName()
Gets the url path component to use when building URLs from categories.
|
static <T,C extends SCMCategory<T>> |
group(C... categories)
Partitions a list of
SCMCategory instances by getName(). |
static <T,C extends SCMCategory<T>> |
group(Iterable<C> categories)
Partitions a collection of
SCMCategory instances by getName(). |
abstract boolean |
isMatch(T instance)
Checks if the supplied instance is a match for this
SCMCategory. |
boolean |
isMatch(T instance,
Iterable<? extends SCMCategory<T>> categories)
Checks if the supplied instance is a match for this
SCMCategory. |
boolean |
isUncategorized()
Checks if this is the uncategorized category.
|
static <C extends SCMCategory<?>> |
toDisplayName(C... categories)
Gets the composite display name for a collection of
SCMCategory instances. |
static <C extends SCMCategory<?>> |
toDisplayName(List<C> categories)
Gets the composite display name for a collection of
SCMCategory instances. |
static <C extends SCMCategory<?>> |
toShortUrl(C... categories)
Gets the composite short url name for a collection of
SCMCategory instances. |
static <C extends SCMCategory<?>> |
toShortUrl(List<C> categories)
Gets the composite short url name for a collection of
SCMCategory instances. |
public SCMCategory(@CheckForNull
org.jvnet.localizer.Localizable displayName)
displayName - the display name.public SCMCategory(@NonNull
String name,
@CheckForNull
org.jvnet.localizer.Localizable displayName)
name - the name of the category. This will likely be used as a path component in building URLsdisplayName - the display name.IllegalArgumentException - if the supplied name is default@NonNull public static <C extends SCMCategory<?>> org.jvnet.localizer.Localizable toDisplayName(C... categories)
SCMCategory instances.C - the type of categories.categories - the categories.@NonNull public static <C extends SCMCategory<?>> org.jvnet.localizer.Localizable toDisplayName(@NonNull List<C> categories)
SCMCategory instances.C - the type of categories.categories - the categories.@NonNull public static <C extends SCMCategory<?>> String toShortUrl(C... categories)
SCMCategory instances.C - the type of categories.categories - the categories.@NonNull public static <C extends SCMCategory<?>> String toShortUrl(List<C> categories)
SCMCategory instances.C - the type of categories.categories - the categories.@NonNull public static <T,C extends SCMCategory<T>> Map<String,List<C>> group(C... categories)
SCMCategory instances by getName().T - the base type of thing.C - the base type of category.categories - the categories to group.SCMCategory instances keyed by getName().@NonNull public static <T,C extends SCMCategory<T>> Map<String,List<C>> group(@NonNull Iterable<C> categories)
SCMCategory instances by getName().T - the base type of thing.C - the base type of category.categories - the categories to group.SCMCategory instances keyed by getName().@NonNull public final String getName()
@NonNull public org.jvnet.localizer.Localizable getDisplayName()
SCMCategory. Must be a
plural and start with a capital letter.SCMCategory.@NonNull protected abstract org.jvnet.localizer.Localizable defaultDisplayName()
SCMCategory.public final boolean isUncategorized()
isMatch(Object)
will not be applied, rather the uncategorized category will pick up everything that has not been captured by
another
category.true if this is a catch-all category.public abstract boolean isMatch(@NonNull
T instance)
SCMCategory.instance - the instance to test.true if the instance belongs to this SCMCategory.public boolean isMatch(@NonNull
T instance,
@Nullable
Iterable<? extends SCMCategory<T>> categories)
SCMCategory.instance - the instance to test.categories - ignored unless isUncategorized() in which case it should be the list of categories.true if the instance belongs to this SCMCategory.Copyright © 2016–2019. All rights reserved.