Skip to content

Commit

Permalink
Consistent use of varargs; deprecated setAnnotatedClass method
Browse files Browse the repository at this point in the history
Issue: SPR-10421
  • Loading branch information
jhoeller committed Aug 5, 2013
1 parent cd523c7 commit 3ba3dd6
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void setMode(int mode) {
* @see Converter
* @see SingleValueConverter
*/
public void setConverters(ConverterMatcher[] converters) {
public void setConverters(ConverterMatcher... converters) {
for (int i = 0; i < converters.length; i++) {
if (converters[i] instanceof Converter) {
getXStream().registerConverter((Converter) converters[i], i);
Expand All @@ -159,8 +159,8 @@ else if (converters[i] instanceof SingleValueConverter) {
}

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

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

/**
* Set a field alias/type map, consiting of field names.
* Set a field alias/type map, consisting of field names.
* @see XStream#aliasField(String, Class, String)
*/
public void setFieldAliases(Map<String, String> aliases) throws ClassNotFoundException, NoSuchFieldException {
Expand All @@ -229,7 +229,7 @@ public void setFieldAliases(Map<String, String> aliases) throws ClassNotFoundExc
* Set types to use XML attributes for.
* @see XStream#useAttributeFor(Class)
*/
public void setUseAttributeForTypes(Class<?>[] types) {
public void setUseAttributeForTypes(Class<?>... types) {
for (Class<?> type : types) {
getXStream().useAttributeFor(type);
}
Expand Down Expand Up @@ -282,7 +282,7 @@ else if (entry.getValue() instanceof List) {
/**
* Specify implicit collection fields, as a Map consisting of {@code Class} instances
* mapped to comma separated collection field names.
*@see XStream#addImplicitCollection(Class, String)
* @see XStream#addImplicitCollection(Class, String)
*/
public void setImplicitCollections(Map<Class<?>, String> implicitCollections) {
for (Map.Entry<Class<?>, String> entry : implicitCollections.entrySet()) {
Expand All @@ -308,19 +308,21 @@ public void setOmittedFields(Map<Class<?>, String> omittedFields) {
}

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

/**
* Set annotated classes for which aliases will be read from class-level JDK 1.5+ annotation metadata.
* Set annotated classes for which aliases will be read from class-level annotation metadata.
* @see XStream#processAnnotations(Class[])
*/
public void setAnnotatedClasses(Class<?>[] annotatedClasses) {
public void setAnnotatedClasses(Class<?>... annotatedClasses) {
Assert.notEmpty(annotatedClasses, "'annotatedClasses' must not be empty");
getXStream().processAnnotations(annotatedClasses);
}
Expand Down Expand Up @@ -355,7 +357,7 @@ public void setEncoding(String encoding) {
* <p>If this property is empty (the default), all classes are supported.
* @see #supports(Class)
*/
public void setSupportedClasses(Class<?>[] supportedClasses) {
public void setSupportedClasses(Class<?>... supportedClasses) {
this.supportedClasses = supportedClasses;
}

Expand Down

0 comments on commit 3ba3dd6

Please sign in to comment.