Last active
May 24, 2017 17:33
-
-
Save sourabhv/41770c3587734aa8d47e36335a4b986f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AutoValue | |
public abstract class Address implements AddressModel { | |
public static final Factory<Address> FACTORY = new Factory<>(new AddressModel.Creator<Address>() { | |
@Override | |
public Address create(long id, @NonNull String name, @NonNull String line1, @Nullable String line2, @Nullable String landmark, @NonNull String city, @NonNull String country, long pincode) { | |
return Address.builder() | |
.id(id) | |
.name(name) | |
.line1(line1) | |
.line2(line2) | |
.landmark(landmark) | |
.city(city) | |
.country(country) | |
.pincode(pincode) | |
.build(); | |
} | |
}); | |
public static final Func1<Cursor, Address> MAPPER = new Func1<Cursor, Address>() { | |
@Override | |
public Address call(Cursor cursor) { | |
return FACTORY.selectAllMapper().map(cursor); | |
} | |
}; | |
public static Builder builder() { | |
return new AutoValue_Address.Builder(); | |
} | |
@AutoValue.Builder | |
public static abstract class Builder { | |
public abstract Builder id(long id); | |
public abstract Builder name(String name); | |
public abstract Builder line1(String line1); | |
public abstract Builder line2(String line2); | |
public abstract Builder landmark(String landmark); | |
public abstract Builder city(String city); | |
public abstract Builder country(String country); | |
public abstract Builder pincode(long pincode); | |
public abstract Address build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment