@@ -70,8 +70,14 @@ public class Languages {
7070 */
7171 public abstract static class LanguageSet {
7272
73- public static LanguageSet from (final Set <String > langs ) {
74- return langs .isEmpty () ? NO_LANGUAGES : new SomeLanguages (langs );
73+ /**
74+ * Gets a language set for the given languages.
75+ *
76+ * @param languages a language set.
77+ * @return a LanguageSet.
78+ */
79+ public static LanguageSet from (final Set <String > languages ) {
80+ return languages .isEmpty () ? NO_LANGUAGES : new SomeLanguages (languages );
7581 }
7682
7783 /**
@@ -81,16 +87,43 @@ public LanguageSet() {
8187 // empty
8288 }
8389
90+ /**
91+ * Tests whether this instance contains the given value.
92+ *
93+ * @param language the value to test.
94+ * @return whether this instance contains the given value.
95+ */
8496 public abstract boolean contains (String language );
8597
98+ /**
99+ * Gets any of this instance's element.
100+ *
101+ * @return any of this instance's element.
102+ */
86103 public abstract String getAny ();
87104
105+ /**
106+ * Tests whether this instance is empty.
107+ *
108+ * @return whether this instance is empty.
109+ */
88110 public abstract boolean isEmpty ();
89111
112+ /**
113+ * Tests whether this instance contains a single element.
114+ *
115+ * @return whether this instance contains a single element.
116+ */
90117 public abstract boolean isSingleton ();
91118
92119 abstract LanguageSet merge (LanguageSet other );
93120
121+ /**
122+ * Returns an instance restricted to this instances and the given values'.
123+ *
124+ * @param other The other instance.
125+ * @return an instance restricted to this instances and the given values'.
126+ */
94127 public abstract LanguageSet restrictTo (LanguageSet other );
95128 }
96129
@@ -114,6 +147,11 @@ public String getAny() {
114147 return this .languages .iterator ().next ();
115148 }
116149
150+ /**
151+ * Gets the language strings
152+ *
153+ * @return the languages strings.
154+ */
117155 public Set <String > getLanguages () {
118156 return this .languages ;
119157 }
@@ -161,6 +199,9 @@ public String toString() {
161199
162200 }
163201
202+ /**
203+ * Marker for any language.
204+ */
164205 public static final String ANY = "any" ;
165206
166207 private static final Map <NameType , Languages > LANGUAGES = new EnumMap <>(NameType .class );
@@ -253,10 +294,22 @@ public String toString() {
253294 }
254295 }
255296
297+ /**
298+ * Gets an instance for the given name type.
299+ *
300+ * @param nameType The name type to lookup.
301+ * @return an instance for the given name type.
302+ */
256303 public static Languages getInstance (final NameType nameType ) {
257304 return LANGUAGES .get (nameType );
258305 }
259306
307+ /**
308+ * Gets a new instance for the given resource name.
309+ *
310+ * @param languagesResourceName the resource name to lookup.
311+ * @return a new instance.
312+ */
260313 public static Languages getInstance (final String languagesResourceName ) {
261314 // read languages list
262315 final Set <String > ls = new HashSet <>();
@@ -289,6 +342,11 @@ private Languages(final Set<String> languages) {
289342 this .languages = languages ;
290343 }
291344
345+ /**
346+ * Gets the language set.
347+ *
348+ * @return the language set.
349+ */
292350 public Set <String > getLanguages () {
293351 return this .languages ;
294352 }
0 commit comments