@@ -234,6 +234,16 @@ public String convert(Object input) {
234234 return (String ) input ;
235235 }
236236 });
237+ classMapping .put (BigDecimal .class , new TypeConverter <BigDecimal >() {
238+ public BigDecimal convert (Object input ) {
239+ return new BigDecimal ((String ) input );
240+ }
241+ });
242+ classMapping .put (BigInteger .class , new TypeConverter <BigInteger >() {
243+ public BigInteger convert (Object input ) {
244+ return new BigInteger ((String ) input );
245+ }
246+ });
237247
238248 collectionMapping .put (List .class , new InstanceCreator <List >() {
239249 public List create () {
@@ -252,50 +262,6 @@ public Map create() {
252262 });
253263 }
254264
255- /**
256- * Returns the current class-to-function mapping used for type conversions.
257- *
258- * @return a map of classes to functions that convert an {@code Object} to that class
259- */
260- public Map <Class <?>, TypeConverter <?>> getClassMapping () {
261- return classMapping ;
262- }
263-
264- /**
265- * Returns the current collection-to-supplier mapping used for instantiating collections.
266- *
267- * @return a map of collection interface types to suppliers of concrete implementations
268- */
269- public Map <Class <?>, InstanceCreator <?>> getCollectionMapping () {
270- return collectionMapping ;
271- }
272-
273- /**
274- * Adds or updates a type conversion function for a given class.
275- *
276- * <p>This allows users to customize how objects are converted into specific types
277- * during processing (e.g., JSON deserialization).
278- *
279- * @param clazz the target class for which the conversion function is to be set
280- * @param function a function that takes an {@code Object} and returns an instance of {@code clazz}
281- */
282- public void setClassMapping (Class <?> clazz , TypeConverter <?> function ) {
283- classMapping .put (clazz , function );
284- }
285-
286- /**
287- * Adds or updates a supplier function for instantiating a collection type.
288- *
289- * <p>This allows customization of which concrete implementation is used for
290- * interface types like {@code List}, {@code Set}, or {@code Map}.
291- *
292- * @param clazz the collection interface class (e.g., {@code List.class})
293- * @param function a supplier that creates a new instance of a concrete implementation
294- */
295- public void setCollectionMapping (Class <?> clazz , InstanceCreator <?> function ) {
296- collectionMapping .put (clazz , function );
297- }
298-
299265 /**
300266 * Construct a JSONObject from a subset of another JSONObject. An array of
301267 * strings is used to identify the keys that should be copied. Missing keys
0 commit comments