List of usage examples for com.google.gson.stream JsonReader nextNull
public void nextNull() throws IOException
From source file:DurationTypeAdapter.java
License:Apache License
@Override public Duration read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; }//w w w .j av a 2s.c om return new Duration(in.nextString()); }
From source file:TemporalTypeAdapter.java
License:Apache License
@Override public T read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; }/*from w w w . j a v a 2 s . co m*/ String temporalString = preProcess(in.nextString()); return parseFunction.apply(temporalString); }
From source file:IntervalTypeAdapter.java
License:Apache License
@Override public Interval read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; }// w w w. j a v a2 s.co m return new Interval(in.nextString()); }
From source file:abtlibrary.utils.as24ApiClient.JSON.java
License:Apache License
@Override public DateTime read(JsonReader in) throws IOException { switch (in.peek()) { case NULL://from w w w . j a v a2 s . co m in.nextNull(); return null; default: String date = in.nextString(); return formatter.parseDateTime(date.substring(0, date.indexOf("Z")) + ".000Z"); } }
From source file:abtlibrary.utils.as24ApiClient.JSON.java
License:Apache License
@Override public LocalDate read(JsonReader in) throws IOException { switch (in.peek()) { case NULL:// w w w . j a v a 2s .c om in.nextNull(); return null; default: String date = in.nextString(); return formatter.parseLocalDate(date); } }
From source file:at.orz.arangodb.entity.CollectionStatusTypeAdapter.java
License:Apache License
@Override public CollectionStatus read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; }//w w w. j a v a 2 s . c o m CollectionStatus ret = CollectionStatus.valueOf(in.nextInt()); return ret; }
From source file:blog.ClassTypeAdapter.java
License:Apache License
@Override public Class<?> read(JsonReader jsonReader) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { jsonReader.nextNull(); return null; }/*from w w w.jav a 2 s . co m*/ Class<?> clazz; try { clazz = Class.forName(jsonReader.nextString()); } catch (ClassNotFoundException exception) { throw new IOException(exception); } return clazz; }
From source file:br.com.caelum.restfulie.gson.converters.DateTypeAdapter.java
License:Apache License
@Override public Date read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; }/* w w w. j ava 2s .c o m*/ return deserializeToDate(in.nextString()); }
From source file:cloud.artik.client.JSON.java
License:Apache License
@Override public DateTime read(JsonReader in) throws IOException { switch (in.peek()) { case NULL:/*from www . j a va 2 s . c om*/ in.nextNull(); return null; default: String date = in.nextString(); return formatter.parseDateTime(date); } }
From source file:cn.ieclipse.af.demo.sample.volley.adapter.IntAdapter.java
License:Apache License
@Override public Number read(JsonReader in) throws IOException { int num = 0;/*from w ww . j a va 2 s.com*/ // 0 if (in.peek() == JsonToken.NULL) { in.nextNull(); num = 0; } else { try { double input = in.nextDouble();//?double?? num = (int) input;//int } catch (NumberFormatException e) { throw new JsonSyntaxException(e); } } return num; }