Java Code Examples for com.dslplatform.json.DslJson#registerReader()
The following examples show how to use
com.dslplatform.json.DslJson#registerReader() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OptionalAnalyzer.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Nullable private static OptionalDecoder analyzeDecoding(final Type manifest, final Type content, final Class<?> raw, final DslJson json) { if (raw != Optional.class) { return null; } else if (content == Optional.class) { final OptionalDecoder nested = analyzeDecoding(content, Object.class, Optional.class, json); final OptionalDecoder outer = new OptionalDecoder<>(nested); json.registerReader(manifest, outer); return outer; } final JsonReader.ReadObject<?> reader = json.tryFindReader(content); if (reader == null) { return null; } final OptionalDecoder decoder = new OptionalDecoder<>(reader); json.registerReader(manifest, decoder); return decoder; }
Example 2
Source File: EnumAnalyzer.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nullable private static EnumDescription analyze(final Type manifest, final Class<Enum> raw, final DslJson json) { if (raw.isArray() || Collection.class.isAssignableFrom(raw) || (raw.getModifiers() & Modifier.ABSTRACT) != 0 || (raw.getDeclaringClass() != null && (raw.getModifiers() & Modifier.STATIC) == 0)) { return null; } final EnumDescription converter = new EnumDescription<>(raw, raw.getEnumConstants()); json.registerWriter(manifest, converter); json.registerReader(manifest, converter); return converter; }
Example 3
Source File: ZonedDateTimeDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(ZonedDateTime.class, ThreetenbpConverter.ZONED_DATE_TIME_READER); json.registerWriter(ZonedDateTime.class, ThreetenbpConverter.ZONED_DATE_TIME_WRITER); }
Example 4
Source File: BitmapDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(android.graphics.Bitmap.class, AndroidGeomConverter.IMAGE_READER); json.registerWriter(android.graphics.Bitmap.class, AndroidGeomConverter.IMAGE_WRITER); }
Example 5
Source File: PointDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(android.graphics.Point.class, AndroidGeomConverter.POINT_READER); json.registerWriter(android.graphics.Point.class, AndroidGeomConverter.POINT_WRITER); }
Example 6
Source File: PointFDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(android.graphics.PointF.class, AndroidGeomConverter.LOCATION_READER); json.registerWriter(android.graphics.PointF.class, AndroidGeomConverter.LOCATION_WRITER); }
Example 7
Source File: RectDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(android.graphics.Rect.class, AndroidGeomConverter.RECTANGLE_READER); json.registerWriter(android.graphics.Rect.class, AndroidGeomConverter.RECTANGLE_WRITER); }
Example 8
Source File: LocalDateDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(org.joda.time.LocalDate.class, JodaTimeConverter.LOCAL_DATE_READER); json.registerWriter(org.joda.time.LocalDate.class, JodaTimeConverter.LOCAL_DATE_WRITER); }
Example 9
Source File: DateTimeDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(org.joda.time.DateTime.class, JodaTimeConverter.DATE_TIME_READER); json.registerWriter(org.joda.time.DateTime.class, JodaTimeConverter.DATE_TIME_WRITER); }
Example 10
Source File: LocalDateDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(LocalDate.class, ThreetenbpConverter.LOCAL_DATE_READER); json.registerWriter(LocalDate.class, ThreetenbpConverter.LOCAL_DATE_WRITER); }
Example 11
Source File: OffsetDateTimeDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(OffsetDateTime.class, ThreetenbpConverter.DATE_TIME_READER); json.registerWriter(OffsetDateTime.class, ThreetenbpConverter.DATE_TIME_WRITER); }
Example 12
Source File: LocalDateTimeDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(LocalDateTime.class, JavaTimeConverter.LOCAL_DATE_TIME_READER); json.registerWriter(LocalDateTime.class, JavaTimeConverter.LOCAL_DATE_TIME_WRITER); }
Example 13
Source File: LocalDateTimeDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(LocalDateTime.class, ThreetenbpConverter.LOCAL_DATE_TIME_READER); json.registerWriter(LocalDateTime.class, ThreetenbpConverter.LOCAL_DATE_TIME_WRITER); }
Example 14
Source File: OffsetDateTimeDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(OffsetDateTime.class, JavaTimeConverter.DATE_TIME_READER); json.registerWriter(OffsetDateTime.class, JavaTimeConverter.DATE_TIME_WRITER); }
Example 15
Source File: OffsetTimeDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(OffsetTime.class, JavaTimeConverter.OFFSET_TIME_READER); json.registerWriter(OffsetTime.class, JavaTimeConverter.OFFSET_TIME_WRITER); }
Example 16
Source File: ZonedDateTimeDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(ZonedDateTime.class, JavaTimeConverter.ZONED_DATE_TIME_READER); json.registerWriter(ZonedDateTime.class, JavaTimeConverter.ZONED_DATE_TIME_WRITER); }
Example 17
Source File: LocalTimeDslJsonConverter.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void configure(DslJson json) { json.registerReader(LocalTime.class, JavaTimeConverter.LOCAL_TIME_READER); json.registerWriter(LocalTime.class, JavaTimeConverter.LOCAL_TIME_WRITER); }