in src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/DuplicatePathnameValidator.java [55:99]
public static AbstractModule module() {
return new AbstractModule() {
private List<String> getAvailableLocales() {
return Lists.transform(
Arrays.asList(Locale.getAvailableLocales()),
new Function<Locale, String>() {
@Override
public String apply(Locale input) {
return input.toString();
}
});
}
@Override
protected void configure() {
DynamicSet.bind(binder(), CommitValidationListener.class)
.to(DuplicatePathnameValidator.class);
bind(ProjectConfigEntry.class)
.annotatedWith(Exports.named(KEY_REJECT_DUPLICATE_PATHNAMES))
.toInstance(
new ProjectConfigEntry(
"Reject Duplicate Pathnames",
null,
ProjectConfigEntryType.BOOLEAN,
null,
false,
"Pushes of commits that contain duplicate pathnames, or that "
+ "contain duplicates of existing pathnames will be "
+ "rejected. Pathnames y and z are considered to be "
+ "duplicates if they are equal, case-insensitive."));
bind(ProjectConfigEntry.class)
.annotatedWith(Exports.named(KEY_REJECT_DUPLICATE_PATHNAMES_LOCALE))
.toInstance(
new ProjectConfigEntry(
"Reject Duplicate Pathnames Locale",
"en",
ProjectConfigEntryType.STRING,
getAvailableLocales(),
false,
"To avoid problems caused by comparing pathnames with different "
+ "locales it is possible to use a specific locale. The "
+ "default is English (en)."));
}
};
}