Пример #1
0
 @Override
 public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
   final Class<? super T> rawType = type.getRawType();
   if (rawType != null && LaDBFluteUtil.isClassificationType(rawType)) {
     @SuppressWarnings("unchecked")
     final TypeAdapter<T> pter = (TypeAdapter<T>) createTypeAdapterClassification(rawType);
     return pter;
   } else {
     return null;
   }
 }
Пример #2
0
 @Override
 public Classification read(JsonReader in) throws IOException {
   if (in.peek() == JsonToken.NULL) {
     in.nextNull();
     return null;
   }
   final String code = in.nextString();
   if (isEmptyToNullReading() && "".equals(code)) { // option
     return null;
   }
   try {
     return LaDBFluteUtil.toVerifiedClassification(clsType, code);
   } catch (ClassificationCodeOfMethodNotFoundException e) {
     throwJsonPropertyClassificationCodeOfMethodNotFoundException(code, in, e);
     return null; // unreachable
   } catch (ClassificationUnknownCodeException e) {
     throwJsonPropertyUnknownClassificationCodeException(code, in, e);
     return null; // unreachable
   }
 }