java.lang.Object
de.linusdev.data.parser.OldJsonParser
Deprecated.
Replaced by
This class is used to parse
json-string to
JsonParserThis class is used to parse
AbstractData to a json string and vice versa
AbstractData to json-string can parse:
-
Boolean,Byte,Short,Integer,Long,Float,Double,String, -
Datable - any primitive type array
-
Object[] andCollectionof the before mentioned Classes
json-string to
SOData can parse:
-
false/true to
Boolean(ignores case) -
null to
null(ignores case) -
Integer Numbers (1, 4, 5, ...) to
Long
(ifsetIdentifyNumberValues(boolean)is set to false (standard) while converting to json-string(!)) -
Decimal Numbers (5.6, ...) to
Double
(ifsetIdentifyNumberValues(boolean)is set to false (standard) while converting to json-string(!))
-
"strings" to
String -
Arrays ([...]) to
ArrayList<Object><Object> -
any other values are not supported and will most likely cause a
ParseException
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetJsonString(AbstractData<?, ?> data) Deprecated.readArrayFromReader(Reader reader) Deprecated.readDataFromFile(Path filePath) Deprecated.readDataFromReader(Reader reader) Deprecated.This will close the reader once finished reading or if an exception has been thrownreadDataFromReader(Reader reader, boolean autoArray, @Nullable String arrayKey) Deprecated.This will close the reader once finished reading or if an exception has been thrownreadDataFromResourceFile(String resource) Deprecated.voidsetIdentifyNumberValues(boolean identifyNumberValues) Deprecated.Default: false puts a single character after a number, to identify which type of number it is Byte: BBYTE_TOKENShort: SSHORT_TOKENInteger: IINTEGER_TOKENLong: LLONG_TOKENFloat: FFLOAT_TOKENDouble: DDOUBLE_TOKENvoidsetOffsetString(String offsetString) Deprecated.Default: " " used for the indentation of the json stringvoidwriteData(AbstractData<?, ?> data, Writer writer) Deprecated.Does NOT close the writer after json has been written!
-
Constructor Details
-
OldJsonParser
public OldJsonParser()Deprecated.
-
-
Method Details
-
readDataFromResourceFile
public SODataListImpl readDataFromResourceFile(String resource) throws IOException, ParseException, NullPointerException Deprecated. -
readDataFromFile
Deprecated.- Throws:
IOExceptionParseException
-
readDataFromReader
Deprecated.This will close the reader once finished reading or if an exception has been thrown
This cannot read pure json arrays (if the json starts with '[' instead of '{')
- Parameters:
reader-Readerto read from- Returns:
SODataListImpl- Throws:
ParseExceptionIOException- See Also:
-
readDataFromReader
public SODataListImpl readDataFromReader(Reader reader, boolean autoArray, @Nullable @Nullable String arrayKey) throws ParseException, IOException Deprecated.This will close the reader once finished reading or if an exception has been thrown
- Parameters:
reader-Readerto read fromautoArray- if the json starts with an array ("[...]"), it will parse this into aSODataListImplarrayKey- the key, which the array should have in the createdSODataListImpl- Returns:
SODataListImpl- Throws:
ParseExceptionIOException
-
readArrayFromReader
Deprecated.- Parameters:
reader- to read from- Returns:
- the Array, represented by the read json. for more information see
OldJsonParser - Throws:
IOExceptionParseException
-
writeData
Deprecated.Does NOT close the writer after json has been written!- Parameters:
data-writer-- Throws:
IOException
-
getJsonString
Deprecated. -
setOffsetString
Deprecated.Default: " " used for the indentation of the json string- Parameters:
offsetString-
-
setIdentifyNumberValues
public void setIdentifyNumberValues(boolean identifyNumberValues) Deprecated.Default: false puts a single character after a number, to identify which type of number it is Byte: BBYTE_TOKENShort: SSHORT_TOKENInteger: IINTEGER_TOKENLong: LLONG_TOKENFloat: FFLOAT_TOKENDouble: DDOUBLE_TOKEN- Parameters:
identifyNumberValues-
-