Skip to content

Commit 3ba3dd6

Browse files
committed
Consistent use of varargs; deprecated setAnnotatedClass method
Issue: SPR-10421
1 parent cd523c7 commit 3ba3dd6

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public void setMode(int mode) {
144144
* @see Converter
145145
* @see SingleValueConverter
146146
*/
147-
public void setConverters(ConverterMatcher[] converters) {
147+
public void setConverters(ConverterMatcher... converters) {
148148
for (int i = 0; i < converters.length; i++) {
149149
if (converters[i] instanceof Converter) {
150150
getXStream().registerConverter((Converter) converters[i], i);
@@ -159,8 +159,8 @@ else if (converters[i] instanceof SingleValueConverter) {
159159
}
160160

161161
/**
162-
* Sets an alias/type map, consisting of string aliases mapped to classes. Keys are aliases; values are either
163-
* {@code Class} instances, or String class names.
162+
* Set an alias/type map, consisting of String aliases mapped to classes.
163+
* <p>Keys are aliases; values are either Class objects or String class names.
164164
* @see XStream#alias(String, Class)
165165
*/
166166
public void setAliases(Map<String, ?> aliases) throws ClassNotFoundException {
@@ -171,9 +171,9 @@ public void setAliases(Map<String, ?> aliases) throws ClassNotFoundException {
171171
}
172172

173173
/**
174-
* Sets the aliases by type map, consisting of string aliases mapped to classes. Any class that is assignable to
175-
* this type will be aliased to the same name. Keys are aliases; values are either
176-
* {@code Class} instances, or String class names.
174+
* Set the aliases by type map, consisting of String aliases mapped to classes.
175+
* <p>Any class that is assignable to this type will be aliased to the same name.
176+
* Keys are aliases; values are either Class objects or String class names.
177177
* @see XStream#aliasType(String, Class)
178178
*/
179179
public void setAliasesByType(Map<String, ?> aliases) throws ClassNotFoundException {
@@ -205,7 +205,7 @@ else if (value instanceof String) {
205205
}
206206

207207
/**
208-
* Set a field alias/type map, consiting of field names.
208+
* Set a field alias/type map, consisting of field names.
209209
* @see XStream#aliasField(String, Class, String)
210210
*/
211211
public void setFieldAliases(Map<String, String> aliases) throws ClassNotFoundException, NoSuchFieldException {
@@ -229,7 +229,7 @@ public void setFieldAliases(Map<String, String> aliases) throws ClassNotFoundExc
229229
* Set types to use XML attributes for.
230230
* @see XStream#useAttributeFor(Class)
231231
*/
232-
public void setUseAttributeForTypes(Class<?>[] types) {
232+
public void setUseAttributeForTypes(Class<?>... types) {
233233
for (Class<?> type : types) {
234234
getXStream().useAttributeFor(type);
235235
}
@@ -282,7 +282,7 @@ else if (entry.getValue() instanceof List) {
282282
/**
283283
* Specify implicit collection fields, as a Map consisting of {@code Class} instances
284284
* mapped to comma separated collection field names.
285-
*@see XStream#addImplicitCollection(Class, String)
285+
* @see XStream#addImplicitCollection(Class, String)
286286
*/
287287
public void setImplicitCollections(Map<Class<?>, String> implicitCollections) {
288288
for (Map.Entry<Class<?>, String> entry : implicitCollections.entrySet()) {
@@ -308,19 +308,21 @@ public void setOmittedFields(Map<Class<?>, String> omittedFields) {
308308
}
309309

310310
/**
311-
* Set the classes for which mappings will be read from class-level JDK 1.5+ annotation metadata.
311+
* Set the classes for which mappings will be read from class-level annotation metadata.
312312
* @see XStream#processAnnotations(Class)
313+
* @deprecated in favor of {@link #setAnnotatedClasses} with varargs
313314
*/
315+
@Deprecated
314316
public void setAnnotatedClass(Class<?> annotatedClass) {
315317
Assert.notNull(annotatedClass, "'annotatedClass' must not be null");
316318
getXStream().processAnnotations(annotatedClass);
317319
}
318320

319321
/**
320-
* Set annotated classes for which aliases will be read from class-level JDK 1.5+ annotation metadata.
322+
* Set annotated classes for which aliases will be read from class-level annotation metadata.
321323
* @see XStream#processAnnotations(Class[])
322324
*/
323-
public void setAnnotatedClasses(Class<?>[] annotatedClasses) {
325+
public void setAnnotatedClasses(Class<?>... annotatedClasses) {
324326
Assert.notEmpty(annotatedClasses, "'annotatedClasses' must not be empty");
325327
getXStream().processAnnotations(annotatedClasses);
326328
}
@@ -355,7 +357,7 @@ public void setEncoding(String encoding) {
355357
* <p>If this property is empty (the default), all classes are supported.
356358
* @see #supports(Class)
357359
*/
358-
public void setSupportedClasses(Class<?>[] supportedClasses) {
360+
public void setSupportedClasses(Class<?>... supportedClasses) {
359361
this.supportedClasses = supportedClasses;
360362
}
361363

0 commit comments

Comments
 (0)