[spring-extensions] branch main updated: Add lang option for specifying language ranges.
Scott Cantor
cantor.2 at osu.edu
Tue Sep 22 13:40:46 UTC 2020
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository spring-extensions.
View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=c4166e2385e9c6ea429537d1b4be18e5b6f4e2ed
The following commit(s) were added to refs/heads/main by this push:
new c4166e2 Add lang option for specifying language ranges.
c4166e2 is described below
commit c4166e2385e9c6ea429537d1b4be18e5b6f4e2ed
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Sep 22 09:40:43 2020 -0400
Add lang option for specifying language ranges.
---
.../ext/spring/cli/AbstractCommandLineArguments.java | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLineArguments.java b/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLineArguments.java
index 353bd3f..37e382b 100644
--- a/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLineArguments.java
+++ b/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLineArguments.java
@@ -20,6 +20,7 @@ package net.shibboleth.ext.spring.cli;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale.LanguageRange;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -28,6 +29,7 @@ import org.slf4j.Logger;
import com.beust.jcommander.Parameter;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
@@ -74,7 +76,11 @@ public abstract class AbstractCommandLineArguments implements CommandLineArgumen
/** Spring property sources. */
@Parameter(names = "--propertyFiles")
- @Nonnull private List<String> propertySources = new ArrayList<>();
+ @Nonnull @NonnullElements private List<String> propertySources = new ArrayList<>();
+
+ /** RFC4647 language ranges. */
+ @Parameter(names = "--lang")
+ @Nullable private String languageRanges;
/** Get the logger for this class.
* This has to be lazy-instantiated otherwise the auto-logging-level fails.
@@ -108,10 +114,19 @@ public abstract class AbstractCommandLineArguments implements CommandLineArgumen
}
/** {@inheritDoc} */
- @Nonnull @Unmodifiable @NotLive public List<String> getPropertyFiles() {
+ @Nonnull @NonnullElements @Unmodifiable @NotLive public List<String> getPropertyFiles() {
return propertySources;
}
+ /**
+ * Get the specified RFC4647 language ranges.
+ *
+ * @return language ranges
+ */
+ @Nonnull @NonnullElements @Unmodifiable @NotLive public List<LanguageRange> getLanguageRanges() {
+ return List.copyOf(LanguageRange.parse(languageRanges));
+ }
+
/** {@inheritDoc} */
@Nonnull @Unmodifiable @NotLive public List<String> getOtherArgs() {
return otherArgs;
@@ -131,6 +146,7 @@ public abstract class AbstractCommandLineArguments implements CommandLineArgumen
out.println();
out.println(String.format(" --%-20s %s", "help", "Prints this help information"));
out.println(String.format(" --%-20s %s", "version", "Prints version"));
+ out.println(String.format(" --%-20s %s", "lang", "Language range for i18n"));
out.println(String.format(" --%-20s %s", "propertyFiles", "Comma-separated list of Spring property files"));
out.println();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list