Package com.blackrook.json
Class JSONDefaultConverter
java.lang.Object
com.blackrook.json.JSONDefaultConverter
- All Implemented Interfaces:
JSONConverter<Object>
Default converter for all types of objects that are not
a part of the annotated conversions. The default converter is meant to cover
Enum
types, Map
types, and other types that implement Iterable
, such as
List
s, Set
s, and other implementations of Collection
.
This is a one-way converter - this goes from Java object to JSON, and not back. It is not recommended to use this converter directly, as this is a catch-all for common conversions without explicit structure.
- Author:
- Matthew Tropiano
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetJSONObject
(Object object) Returns a JSON object that represents this object instance (and its contents).getObject
(JSONObject jsonObject) Returns null.
-
Constructor Details
-
JSONDefaultConverter
public JSONDefaultConverter()
-
-
Method Details
-
getJSONObject
Description copied from interface:JSONConverter
Returns a JSON object that represents this object instance (and its contents). The policy of this method is to help return something that can be converted back to Java viaJSONConverter.getObject(JSONObject)
with close-to or dead-on 100% equivalence.- Specified by:
getJSONObject
in interfaceJSONConverter<Object>
- Parameters:
object
- the object to inspect.- Returns:
- an accurate JSONObject that represents this object.
-
getObject
Returns null.- Specified by:
getObject
in interfaceJSONConverter<Object>
- Parameters:
jsonObject
- the JSON Object to convert.- Returns:
- an accurate object from the JSON.
-