Skip to content

Commit

Permalink
The class LocaleBeanUtils no longer extends BeanUtils (both classes only
Browse files Browse the repository at this point in the history
contains static methods)

- Make class final
- Make constructor private
- Remove trailing whitespace
  • Loading branch information
garydgregory committed Jan 31, 2025
1 parent 6f71fcf commit 9cbcb9d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<action type="fix" dev="ggregory" due-to="Gary Gregory">The constructor org.apache.commons.beanutils2.ConvertUtils is now private (the class only contains static methods).</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">The class org.apache.commons.beanutils2.ConstructorUtils is now final (the class only contains static methods).</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">The constructor org.apache.commons.beanutils2.ConstructorUtils is now private (the class only contains static methods).</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">The class LocaleBeanUtils no longer extends BeanUtils (both classes only contains static methods).</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">The class org.apache.commons.beanutils2.BeanUtils is now final (the class only contains static methods).</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">The constructor org.apache.commons.beanutils2.BeanUtils is now private (the class only contains static methods).</action>
<!-- ADD -->
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Gary Gregory">Bump org.apache.commons:commons-parent from 78 to 81.</action>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/apache/commons/beanutils2/BeanUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
* @see BeanUtilsBean
*/
public class BeanUtils {
public final class BeanUtils {

/** An empty class array */
static final Class<?>[] EMPTY_CLASS_ARRAY = {};
Expand Down Expand Up @@ -359,4 +359,8 @@ public static void populate(final Object bean, final Map<String, ? extends Objec
public static void setProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException {
BeanUtilsBean.getInstance().setProperty(bean, name, value);
}

private BeanUtils() {
// empty
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public static <T> Class<T> primitiveToWrapper(final Class<T> type) {
public static <T> void register(final Converter<T> converter, final Class<T> clazz) {
ConvertUtilsBean.getInstance().register(converter, clazz);
}

private ConvertUtils() {
// empty
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/commons/beanutils2/MethodUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ public static Object invokeStaticMethod(final Class<?> objectClass, final String
* @param parameterization the type of parameter being tested
* @return true if the assignment is compatible.
*/
public static final boolean isAssignmentCompatible(final Class<?> parameterType, final Class<?> parameterization) {
public static boolean isAssignmentCompatible(final Class<?> parameterType, final Class<?> parameterization) {
// try plain assignment
if (parameterType.isAssignableFrom(parameterization)) {
return true;
Expand Down Expand Up @@ -1170,7 +1170,7 @@ public static Class<?> toNonPrimitiveClass(final Class<?> clazz) {
}
return clazz;
}

private MethodUtils() {
// empty
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Locale;

import org.apache.commons.beanutils2.BeanUtils;

/**
* <p>
* Utility methods for populating JavaBeans properties via reflection in a locale-dependent manner.
Expand All @@ -31,7 +29,7 @@
* The implementations for these methods are provided by {@code LocaleBeanUtilsBean}. For more details see {@link LocaleBeanUtilsBean}.
* </p>
*/
public final class LocaleBeanUtils extends BeanUtils {
public final class LocaleBeanUtils {

/**
* <p>
Expand Down Expand Up @@ -546,7 +544,7 @@ public static void setProperty(final Object bean, final String name, final Objec
throws IllegalAccessException, InvocationTargetException {
LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().setProperty(bean, name, value, pattern);
}

private LocaleBeanUtils() {
// empty
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public static void setApplyLocalized(final boolean newApplyLocalized) {
public static void setDefaultLocale(final Locale locale) {
LocaleConvertUtilsBean.getInstance().setDefaultLocale(locale);
}

private LocaleConvertUtils() {
// empty
}
Expand Down

0 comments on commit 9cbcb9d

Please sign in to comment.