code: @Override
      public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
          final Class<? super T> rawType = type.getRawType();
          if (rawType == null) {
              return null;
          }
          if (yourType.isAssignableFrom(rawType)) {
              @SuppressWarnings("unchecked")
              final TypeAdapter<T> pter = (TypeAdapter<T>) createYourScalarTypeAdapter();
              return pter;
          } else {
              return null;
          }
      }
docs: ======