Last active
August 1, 2017 15:56
-
-
Save catalinghita8/d7d659d157e78e3dd099584a7060fd5a 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
@IgnoreExtraProperties | |
public class BookObject extends ArrayList<BookObject> { | |
public String title; | |
public String subtitle; | |
public String authors; | |
public String imageURL; | |
private String pushId; | |
public BookObject(){} | |
public BookObject(String Title , String Subtitle , String[] Authors , String ImageURL) | |
{ | |
this.title = Title; | |
this.subtitle = Subtitle; | |
this.authors = ConvertToString(Authors); | |
this.imageURL = ImageURL; | |
} | |
@Exclude | |
public String ConvertToString(String[] arr) | |
{ | |
StringBuilder builder = new StringBuilder(); | |
for(int i = 0; i < arr.length; i++) | |
{ | |
if(i == arr.length - 1) { | |
builder.append(arr[i]); | |
builder.append("."); | |
} | |
else | |
{ | |
builder.append(arr[i]); | |
builder.append(","); | |
} | |
} | |
String str = builder.toString(); | |
return str; | |
} | |
public String getTitle() | |
{ | |
return title; | |
} | |
public String getSubtitle() | |
{ | |
return subtitle; | |
} | |
public String getAuthors() | |
{ | |
return authors; | |
} | |
public String getImageURL(){ return imageURL;} | |
public String getPushId() {return pushId;} | |
public void setPushId(String pushId) {this.pushId = pushId;} | |
@Exclude | |
public Map<String, Object> toMap() { | |
HashMap<String, Object> result = new HashMap<>(); | |
result.put("title", title); | |
result.put("subtitle", subtitle); | |
result.put("authors", authors); | |
result.put("imageURL", imageURL); | |
return result; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`@IgnoreExtraProperties
public class BookObject extends ArrayList {
public String Title;
public String Subtitle;
public String Authors;
public String ImageURL;
@exclude
private String pushId;
@exclude
public String getPushId() {
return pushId;
}
@exclude
public void setPushId(String pushId) {
this.pushId = pushId;
}
@exclude
public Map<String, Object> toMap() {
HashMap<String, Object> result = new HashMap<>();
result.put("title", Title);
result.put("subtitle", Subtitle);
result.put("authors", Authors);
result.put("imageURL", ImageURL);
}`