Skip to content

Commit 6815b85

Browse files
committed
Deprecate LocaleConvertUtils.LocaleConvertUtils()
1 parent c151714 commit 6815b85

File tree

3 files changed

+46
-40
lines changed

3 files changed

+46
-40
lines changed

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate BeanUtils.BeanUtils().</action>
3737
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate ConstructorUtils.ConstructorUtils().</action>
3838
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate LocaleBeanUtils.LocaleBeanUtils().</action>
39+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate LocaleConvertUtils.LocaleConvertUtils().</action>
3940
<!-- ADD -->
4041
<!-- UPDATE -->
4142
<action dev="ggregory" type="update" due-to="Gary Gregory">Bump org.apache.commons:commons-parent from 78 to 81.</action>

src/main/java/org/apache/commons/beanutils/locale/LocaleBeanUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ public static void setProperty(final Object bean, final String name, final Objec
741741
*
742742
* @deprecated Will be private in 2.0.
743743
*/
744+
@Deprecated
744745
public LocaleBeanUtils() {
745746
// empty
746747
}

src/main/java/org/apache/commons/beanutils/locale/LocaleConvertUtils.java

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public static String convert(final Object value) {
5959
* @see LocaleConvertUtilsBean#convert(Object, Locale, String)
6060
*/
6161
public static String convert(final Object value, final Locale locale, final String pattern) {
62-
6362
return LocaleConvertUtilsBean.getInstance().convert(value, locale, pattern);
6463
}
6564

@@ -90,7 +89,6 @@ public static String convert(final Object value, final String pattern) {
9089
* @see LocaleConvertUtilsBean#convert(String, Class)
9190
*/
9291
public static Object convert(final String value, final Class<?> clazz) {
93-
9492
return LocaleConvertUtilsBean.getInstance().convert(value, clazz);
9593
}
9694

@@ -109,7 +107,6 @@ public static Object convert(final String value, final Class<?> clazz) {
109107
* @see LocaleConvertUtilsBean#convert(String, Class, Locale, String)
110108
*/
111109
public static Object convert(final String value, final Class<?> clazz, final Locale locale, final String pattern) {
112-
113110
return LocaleConvertUtilsBean.getInstance().convert(value, clazz, locale, pattern);
114111
}
115112

@@ -127,25 +124,26 @@ public static Object convert(final String value, final Class<?> clazz, final Loc
127124
* @see LocaleConvertUtilsBean#convert(String, Class, String)
128125
*/
129126
public static Object convert(final String value, final Class<?> clazz, final String pattern) {
130-
131127
return LocaleConvertUtilsBean.getInstance().convert(value, clazz, pattern);
132128
}
133129

134130
/**
135-
* <p>Convert an array of specified values to an array of objects of the
136-
* specified class (if possible).</p>
137-
*
138-
* <p>For more details see <code>LocaleConvertUtilsBean</code></p>
139-
*
140-
* @param values Value to be converted (may be null)
141-
* @param clazz Java array or element class to be converted to
142-
* @return the converted value
143-
* @see LocaleConvertUtilsBean#convert(String[], Class)
144-
*/
145-
public static Object convert(final String[] values, final Class<?> clazz) {
146-
147-
return LocaleConvertUtilsBean.getInstance().convert(values, clazz);
148-
}
131+
* <p>
132+
* Convert an array of specified values to an array of objects of the specified class (if possible).
133+
* </p>
134+
*
135+
* <p>
136+
* For more details see <code>LocaleConvertUtilsBean</code>
137+
* </p>
138+
*
139+
* @param values Value to be converted (may be null)
140+
* @param clazz Java array or element class to be converted to
141+
* @return the converted value
142+
* @see LocaleConvertUtilsBean#convert(String[], Class)
143+
*/
144+
public static Object convert(final String[] values, final Class<?> clazz) {
145+
return LocaleConvertUtilsBean.getInstance().convert(values, clazz);
146+
}
149147

150148
/**
151149
* <p>Convert an array of specified values to an array of objects of the
@@ -161,7 +159,6 @@ public static Object convert(final String[] values, final Class<?> clazz) {
161159
* @see LocaleConvertUtilsBean#convert(String[], Class, Locale, String)
162160
*/
163161
public static Object convert(final String[] values, final Class<?> clazz, final Locale locale, final String pattern) {
164-
165162
return LocaleConvertUtilsBean.getInstance().convert(values, clazz, locale, pattern);
166163
}
167164

@@ -178,7 +175,6 @@ public static Object convert(final String[] values, final Class<?> clazz, final
178175
* @see LocaleConvertUtilsBean#convert(String[], Class, String)
179176
*/
180177
public static Object convert(final String[] values, final Class<?> clazz, final String pattern) {
181-
182178
return LocaleConvertUtilsBean.getInstance().convert(values, clazz, pattern);
183179
}
184180

@@ -195,7 +191,6 @@ public static Object convert(final String[] values, final Class<?> clazz, final
195191
*/
196192
@Deprecated
197193
protected static FastHashMap create(final Locale locale) {
198-
199194
return LocaleConvertUtilsBean.getInstance().create(locale);
200195
}
201196

@@ -207,34 +202,35 @@ protected static FastHashMap create(final Locale locale) {
207202
* @see LocaleConvertUtilsBean#deregister()
208203
*/
209204
public static void deregister() {
210-
211205
LocaleConvertUtilsBean.getInstance().deregister();
212206
}
213207

214-
/**
215-
* <p>Remove any registered {@link LocaleConverter} for the specified locale and Class.</p>
216-
*
217-
* <p>For more details see <code>LocaleConvertUtilsBean</code></p>
218-
*
219-
* @param clazz Class for which to remove a registered Converter
220-
* @param locale The locale
221-
* @see LocaleConvertUtilsBean#deregister(Class, Locale)
222-
*/
223-
public static void deregister(final Class<?> clazz, final Locale locale) {
224-
225-
LocaleConvertUtilsBean.getInstance().deregister(clazz, locale);
226-
}
227-
228208
/**
229-
* <p>Remove any registered {@link LocaleConverter} for the specified locale.</p>
209+
* <p>Remove any registered {@link LocaleConverter} for the specified locale and Class.</p>
230210
*
231211
* <p>For more details see <code>LocaleConvertUtilsBean</code></p>
232212
*
213+
* @param clazz Class for which to remove a registered Converter
214+
* @param locale The locale
215+
* @see LocaleConvertUtilsBean#deregister(Class, Locale)
216+
*/
217+
public static void deregister(final Class<?> clazz, final Locale locale) {
218+
LocaleConvertUtilsBean.getInstance().deregister(clazz, locale);
219+
}
220+
221+
/**
222+
* <p>
223+
* Remove any registered {@link LocaleConverter} for the specified locale.
224+
* </p>
225+
*
226+
* <p>
227+
* For more details see <code>LocaleConvertUtilsBean</code>
228+
* </p>
229+
*
233230
* @param locale The locale
234231
* @see LocaleConvertUtilsBean#deregister(Locale)
235232
*/
236233
public static void deregister(final Locale locale) {
237-
238234
LocaleConvertUtilsBean.getInstance().deregister(locale);
239235
}
240236

@@ -310,7 +306,6 @@ protected static FastHashMap lookup(final Locale locale) {
310306
* @see LocaleConvertUtilsBean#register(LocaleConverter, Class, Locale)
311307
*/
312308
public static void register(final LocaleConverter converter, final Class<?> clazz, final Locale locale) {
313-
314309
LocaleConvertUtilsBean.getInstance().register(converter, clazz, locale);
315310
}
316311

@@ -337,7 +332,16 @@ public static void setApplyLocalized(final boolean newApplyLocalized) {
337332
* @see LocaleConvertUtilsBean#setDefaultLocale(Locale)
338333
*/
339334
public static void setDefaultLocale(final Locale locale) {
340-
341335
LocaleConvertUtilsBean.getInstance().setDefaultLocale(locale);
342336
}
337+
338+
/**
339+
* Deprecated, all methods are static.
340+
*
341+
* @deprecated Will be private in 2.0.
342+
*/
343+
@Deprecated
344+
public LocaleConvertUtils() {
345+
// empty
346+
}
343347
}

0 commit comments

Comments
 (0)