Example #1
0
    /**
     * Default type adapters should only be called if {@code Gson.TypeAdapters} annotation is
     * definitely in classpath. Currenlty, it is called by for mongo repository module, which have
     * {@code gson} module as a transitive dependency.
     *
     * @return default type adapters
     */
    @Value.Lazy
    TypeAdaptersMirror defaultTypeAdapters() {
      @Nullable
      TypeElement typeElement =
          processing().getElementUtils().getTypeElement(TypeAdaptersMirror.qualifiedName());

      Preconditions.checkState(
          typeElement != null,
          "Processor internal error, @%s is not know to be on the classpath",
          TypeAdaptersMirror.qualifiedName());

      return TypeAdaptersMirror.from(typeElement);
    }