org.dominokit.jacksonapt.deser.array.cast.BaseJsNumberArrayReader Maven / Gradle / Ivy
The newest version!
package org.dominokit.jacksonapt.deser.array.cast;
import elemental2.core.JsArray;
import elemental2.core.JsNumber;
import jsinterop.base.Js;
import org.dominokit.jacksonapt.stream.JsonReader;
import org.dominokit.jacksonapt.stream.JsonToken;
/**
* Abstract BaseJsNumberArrayReader class.
*
* @author vegegoku
* @version $Id: $Id
*/
public abstract class BaseJsNumberArrayReader {
JsArray readNumberArray(JsonReader reader){
JsArray jsArray = new JsArray<>();
reader.beginArray();
while (JsonToken.END_ARRAY != reader.peek()) {
if (JsonToken.NULL == reader.peek()) {
reader.skipValue();
jsArray.push(null);
} else {
jsArray.push((JsNumber) Js.cast(reader.nextInt()));
}
}
reader.endArray();
return jsArray;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy