auto-value

Using AutoValueSchema in Apache Beam PCollection gives `RuntimeException: Creator parameter arg0 Doesn't correspond to a schema field`

六月ゝ 毕业季﹏ 提交于 2020-12-13 04:46:24
问题 I am trying to have a PCollection of AutoValue-defined objects that I have created, and I've added the appropriate annotations to infer the Schema via DefaultSchema(AutoValueSchema.class) . Like so: @DefaultSchema(AutoValueSchema.class) @AutoValue public abstract class MyAutoClas { public abstract String getMyStr(); public abstract Integer getMyInt(); @CreateSchema public static MyAutoClass create(String myStr, Integer myInt) { return new AutoValue_MyAutoClass(myStr, myInt); } } I have a

Auto-value-gson with an interface error, register an InstanceCreator?

∥☆過路亽.° 提交于 2020-01-22 02:46:05
问题 I have an interface class that looks like this. public interface Species { String name(); } And a Human class that implements @AutoValue with a TypeAdapter. @AutoValue public abstract class Human implements Parcelable, Species { public static Human create(String humanVariable) { return new AutoValue_Human(humanVariable); } public static Human create(String name, String humanVariable) { return new AutoValue_Human(name, humanVariable); } public static TypeAdapter<Human> typeAdapter(Gson gson) {

Android Room Persistence library entity with AutoValue

♀尐吖头ヾ 提交于 2020-01-01 04:24:10
问题 Is it possible to use both Room persistence library's @Entity with AutoValue's @AutoValue and builder on the same POJO? How should i do it? 回答1: AFAIK, as of 1.0.0-alpha3 , this is not possible. Room wants fields; AutoValue doesn't expose fields. Keep tabs on this feature request for progress in this area. 回答2: This feature will be available in Room 2.1.0 https://issuetracker.google.com/issues/62408420#comment27 回答3: Following this task, apparently they added support. I assume it will be

@AutoValue - “cannot find symbol class Generated” Error

寵の児 提交于 2019-12-24 03:07:15
问题 I am getting "cannot find symbol class Generated" while using the @AutoValue annotation. public abstract class Office{ public static Office create(String cityName, String companyName, String regionName) { return new AutoValue_Office(cityName, companyName, regionName); } public abstract String getCompanyName(); public abstract String getCityName(); public abstract String getRegionName(); } Gradle dependency compile 'com.google.auto.value:auto-value:1.0-rc1' Also, how can add only selected

Eclipse AutoValue class fails to build

假装没事ソ 提交于 2019-12-22 08:39:36
问题 I'm running Eclipse Kepler SR2, with Maven 3.1.1 attached with the m2e and m2e-apt plugins, and I'm getting an error I don't know how to resolve. I managed to find all the dependencies needed to get @AutoValue working into my pom.xml, but now I'm in a state where it only works if the methods which need to be defined all have primitive return types. If I provide an abstract getter which returns an Object or more specific, I get this error: @AutoValue processor threw an exception: java.lang

How to use AutoValue with Retrofit 2?

佐手、 提交于 2019-12-20 10:48:30
问题 I've got AutoValue (and the android-apt plugin) working in a project, and I'm aware of Ryan Harter's gson extension for AutoValue, but how do I hook Retrofit 2 up to use the extension and factory method on the abstract class? String grantType = "password"; Call<SignIn> signInCall = retrofitApi.signIn(email, password, grantType); signInCall.enqueue(callback); eg here I would like to use AutoValue with the SignIn JSON model object to enforce immutability but how do I hook up Retrofit (or

Android Gradle annotationProcessor not available in parent module

大憨熊 提交于 2019-12-14 03:49:39
问题 I'm having the following setup: ProjectA build.gralde: dependencies { compile (project(':ProjectB')) } ProjectB build.gradle: dependencies { annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.5' compile "com.google.auto.value:auto-value:1.3" annotationProcessor "com.google.auto.value:auto-value:1.3" } And SomeClass in ProjectA that is implementing Parcelable @AutoValue public abstract class SomeClass implements Parcelable { ... } AutoValue won't generate any Parcelable

FreeBuilder in an Android Studio Java module

﹥>﹥吖頭↗ 提交于 2019-12-12 03:06:40
问题 I want to use FreeBuilder in a Java module in Android Studio. I added the following dependency in the module dependencies: compile 'org.inferred:freebuilder:1.10.5' Then I created the following class: @FreeBuilder public abstract class MyClass { public abstract String getValue1(); public abstract String getValue2(); public abstract String getValue3(); public static class Builder extends MyClass_Builder { } } I can see that the MyClass_Builder class is correctly generated in the build/classes

Columns for Value Objects in entities are not created on start-up

人盡茶涼 提交于 2019-12-11 07:24:38
问题 I'm using Spring Boot with Spring Data and H2 in-memory db and wanted to try using Value Objects instead of Strings everywhere and I found this neat library: AutoValue to create Value Objects. So here is my entity: @Entity @Access(AccessType.FIELD) // so I can avoid using setters for fields that won't change class Address { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long addressId; @Embedded private State state; @Embedded private ZipCode zipCode; @Embedded private City city;

Cannot resolve symbol with AutoValue and IntelliJ

瘦欲@ 提交于 2019-12-05 21:34:22
问题 I have been trying to find the correct settings for IntelliJ's annotation processing in order for it to co-exist with Gradle's build process. Whenever I build from IntelliJ I cannot get it to recognise the generated sources from the gradle-apt-plugin. My requirements for my project are: Building between IntelliJ and Gradle should be seamless and not interfere with the process of each other I need to use IntelliJ's Create separate module per source set option I need to use IntelliJ's folder