Skip to content

Instantly share code, notes, and snippets.

@TripleFrequency
Last active March 22, 2018 00:05
Show Gist options
  • Save TripleFrequency/9e62eb02b3b99560c2367071c9457a3c to your computer and use it in GitHub Desktop.
Save TripleFrequency/9e62eb02b3b99560c2367071c9457a3c to your computer and use it in GitHub Desktop.
Kotlin vs Java boiler-plate code
package media.thehoard.thirdparty.api.trakt.objects.post.checkins;
import media.thehoard.thirdparty.api.trakt.objects.basic.implementations.TraktSharingImpl;
public interface TraktCheckinPost<T extends TraktCheckinPost> {
TraktSharingImpl getSharing();
void setSharing(TraktSharingImpl sharing);
T withSharing(TraktSharingImpl sharing);
String getMessage();
void setMessage(String message);
T withMessage(String message);
String getAppVersion();
void setAppVersion(String appVersion);
T withAppVersion(String appVersion);
String getAppDate();
void setAppDate(String appDate);
T withAppDate(String appDate);
String getFoursquareVenueId();
void setFoursquareVenueId(String foursquareVenueId);
T withFoursquareVenueId(String foursquareVenueId);
String getFoursquareVenueName();
void setFoursquareVenueName(String foursquareVenueName);
T withFoursquareVenueName(String foursquareVenueName);
}
package media.thehoard.thirdparty.api.trakt.objects.post.checkins
import media.thehoard.thirdparty.api.trakt.objects.basic.TraktSharing
interface TraktCheckinPost {
var sharing: TraktSharing
var message: String
var appVersion: String
var appDate: String
var foursquareVenueId: String
var foursquareVenueName: String
}
package media.thehoard.thirdparty.api.trakt.objects.post.checkins;
import media.thehoard.thirdparty.api.trakt.objects.get.movies.implementations.TraktMovieImpl;
public interface TraktMovieCheckinPost extends TraktCheckinPost<TraktMovieCheckinPost> {
TraktMovieImpl getMovie();
void setMovie(TraktMovieImpl movie);
TraktMovieCheckinPost withMovie(TraktMovieImpl movie);
}
package media.thehoard.thirdparty.api.trakt.objects.post.checkins
import media.thehoard.thirdparty.api.trakt.objects.get.movies.TraktMovie
interface TraktMovieCheckinPost : TraktCheckinPost {
var movie: TraktMovie
}
package media.thehoard.thirdparty.api.trakt.objects.post.checkins.implementations;
import com.google.gson.annotations.SerializedName;
import media.thehoard.thirdparty.api.trakt.objects.basic.implementations.TraktSharingImpl;
import media.thehoard.thirdparty.api.trakt.objects.get.movies.implementations.TraktMovieImpl;
import media.thehoard.thirdparty.api.trakt.objects.post.checkins.TraktMovieCheckinPost;
public class TraktMovieCheckinPostImpl implements TraktMovieCheckinPost {
private TraktSharingImpl sharing;
private String message;
@SerializedName("app_version")
private String appVersion;
@SerializedName("app_date")
private String appDate;
@SerializedName("venue_id")
private String foursquareVenueId;
@SerializedName("venue_name")
private String foursquareVenueName;
private TraktMovieImpl movie;
@Override
public TraktSharingImpl getSharing() {
return sharing;
}
@Override
public void setSharing(TraktSharingImpl sharing) {
this.sharing = sharing;
}
@Override
public TraktMovieCheckinPost withSharing(TraktSharingImpl sharing) {
this.sharing = sharing;
return this;
}
@Override
public String getMessage() {
return message;
}
@Override
public void setMessage(String message) {
this.message = message;
}
@Override
public TraktMovieCheckinPost withMessage(String message) {
this.message = message;
return this;
}
@Override
public String getAppVersion() {
return appVersion;
}
@Override
public void setAppVersion(String appVersion) {
this.appVersion = appVersion;
}
@Override
public TraktMovieCheckinPost withAppVersion(String appVersion) {
this.appVersion = appVersion;
return this;
}
@Override
public String getAppDate() {
return appDate;
}
@Override
public void setAppDate(String appDate) {
this.appDate = appDate;
}
@Override
public TraktMovieCheckinPost withAppDate(String appDate) {
this.appDate = appDate;
return this;
}
@Override
public String getFoursquareVenueId() {
return foursquareVenueId;
}
@Override
public void setFoursquareVenueId(String foursquareVenueId) {
this.foursquareVenueId = foursquareVenueId;
}
@Override
public TraktMovieCheckinPost withFoursquareVenueId(String foursquareVenueId) {
this.foursquareVenueId = foursquareVenueId;
return this;
}
@Override
public String getFoursquareVenueName() {
return foursquareVenueName;
}
@Override
public void setFoursquareVenueName(String foursquareVenueName) {
this.foursquareVenueName = foursquareVenueName;
}
@Override
public TraktMovieCheckinPost withFoursquareVenueName(String foursquareVenueName) {
this.foursquareVenueName = foursquareVenueName;
return this;
}
@Override
public TraktMovieImpl getMovie() {
return movie;
}
@Override
public void setMovie(TraktMovieImpl movie) {
this.movie = movie;
}
@Override
public TraktMovieCheckinPost withMovie(TraktMovieImpl movie) {
this.movie = movie;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TraktMovieCheckinPostImpl that = (TraktMovieCheckinPostImpl) o;
if (sharing != null ? !sharing.equals(that.sharing) : that.sharing != null) return false;
if (message != null ? !message.equals(that.message) : that.message != null) return false;
if (appVersion != null ? !appVersion.equals(that.appVersion) : that.appVersion != null) return false;
if (appDate != null ? !appDate.equals(that.appDate) : that.appDate != null) return false;
if (foursquareVenueId != null ? !foursquareVenueId.equals(that.foursquareVenueId)
: that.foursquareVenueId != null) return false;
if (foursquareVenueName != null ? !foursquareVenueName.equals(that.foursquareVenueName)
: that.foursquareVenueName != null) return false;
return movie != null ? movie.equals(that.movie) : that.movie == null;
}
@Override
public int hashCode() {
int result = sharing != null ? sharing.hashCode() : 0;
result = 31 * result + (message != null ? message.hashCode() : 0);
result = 31 * result + (appVersion != null ? appVersion.hashCode() : 0);
result = 31 * result + (appDate != null ? appDate.hashCode() : 0);
result = 31 * result + (foursquareVenueId != null ? foursquareVenueId.hashCode() : 0);
result = 31 * result + (foursquareVenueName != null ? foursquareVenueName.hashCode() : 0);
result = 31 * result + (movie != null ? movie.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "TraktMovieCheckinPost{" + "sharing=" + sharing + ", message='" + message + '\'' + ", appVersion='" + appVersion + '\'' + ", appDate='" + appDate + '\'' + ", foursquareVenueId='" + foursquareVenueId + '\'' + ", foursquareVenueName='" + foursquareVenueName + '\'' + ", movie=" + movie + '}';
}
}
package media.thehoard.thirdparty.api.trakt.objects.post.checkins.implementations
import com.google.gson.annotations.SerializedName
import media.thehoard.thirdparty.api.trakt.objects.basic.TraktSharing
import media.thehoard.thirdparty.api.trakt.objects.get.movies.TraktMovie
import media.thehoard.thirdparty.api.trakt.objects.post.checkins.TraktMovieCheckinPost
data class TraktMovieCheckinPostImpl(override var sharing: TraktSharing,
override var message: String,
@SerializedName("app_version") override var appVersion: String,
@SerializedName("app_date") override var appDate: String,
@SerializedName("venue_id") override var foursquareVenueId: String,
@SerializedName("venue_name") override var foursquareVenueName: String,
override var movie: TraktMovie) : TraktMovieCheckinPost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment