public abstract String username(); public abstract String email(); public static User create(String username, String email) { return builder().username(username).email(email).build(); } public static Builder builder() { return new AutoValue_User.Builder(); } @AutoValue.Builder public abstract static class Builder { public abstract Builder email(String email); public abstract Builder username(String username); public abstract User build(); } }
abstract class User { @Nullable public abstract String username(); public abstract String email(); public static User create(String username, String email) { return new AutoValue_User(username, email); } }
{ public static MutableExample create(MutablePropertyType ouch) { // Replace `.clone` below with the right copying code for this type return new AutoValue_MutableExample(ouch.clone()); } /** * Returns the ouch associated with this object; <b>do not mutate</b> the * returned object. */ public abstract MutablePropertyType ouch(); }
this Extension applies to the given context. public boolean applicable(Context context) { return false; } //Denotes that the class generated by this Extension must be the final class in the inheritance hierarchy. public boolean mustBeFinal(Context context) { return false; } //Returns a possibly empty set of property names that this Extension intends to implement public Set<String> consumeProperties(Context context) { return Collections.emptySet(); } //Returns a possible empty set of abstract methods that this Extension intends to implement public Set<ExecutableElement> consumeMethods(Context context) { return Collections.emptySet(); } //Returns the generated source code of the class public abstract String generateClass(Context context, String className, String classToExtend, boolean isFinal); }
public abstract String username(); public abstract String email(); public static TypeAdapter<User> typeAdapter(Gson gson) { return new AutoValue_User.GsonTypeAdapter(gson); } }