Back to project page Joetz-Android-V2.
The source code is released under:
GNU General Public License
If you think the Android project Joetz-Android-V2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.jens.myapplication.domain; //from w w w .j av a 2 s . c o m import com.example.jens.myapplication.domain.converter.UnixDateTimeConverter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import org.joda.time.DateTime; import java.math.BigDecimal; import java.util.List; /** * Created by Sam on 23/10/2014. */ @JsonIgnoreProperties(ignoreUnknown = true) public class Camp { @JsonProperty("Description") private String description; @JsonProperty("Id") private long id; @JsonProperty("Title") private String title; @JsonProperty("MinimumAge") private int minimumAge; @JsonProperty("MaximumAge") private int maximumAge; @JsonProperty("Location") private String location; @JsonProperty("Summary") private String summary; //Will be UNIX in JSON (Needs conversion) @JsonIgnore private DateTime startDate; @JsonIgnore private DateTime endDate; @JsonProperty("MaximumParticipants") private int maxParticipants; @JsonProperty("Price") private BigDecimal price; @JsonProperty("Images") private List<Integer> images; @JsonProperty("ThumbnailId") private int thumbnailId; @JsonProperty("FreeSpots") private int freeSpots; @JsonProperty("Monitors") private List<String> monitors; @JsonIgnore private PeriodCategory periodCategory; public Camp(){ } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getMinimumAge() { return minimumAge; } public void setMinimumAge(int minimumAge) { this.minimumAge = minimumAge; } public int getMaximumAge() { return maximumAge; } public void setMaximumAge(int maximumAge) { this.maximumAge = maximumAge; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getSummary() { return summary; } public void setSummary(String summary) { this.summary = summary; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public int getMaxParticipants() { return maxParticipants; } public void setMaxParticipants(int maxParticipants) { this.maxParticipants = maxParticipants; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } @JsonIgnore public DateTime getStartDate() { return startDate; } @JsonIgnore public void setStartDate(DateTime startDate) { this.startDate = startDate; } @JsonIgnore public DateTime getEndDate() { return endDate; } @JsonIgnore public void setEndDate(DateTime endDate) { this.endDate = endDate; } //Dates are in UNIX format in json @JsonProperty("StartDate") public long getStartDateJson(){ return UnixDateTimeConverter.getUnix(startDate); } @JsonProperty("StartDate") public void setStartDateJson(long unixTime){ setStartDate(UnixDateTimeConverter.getDate(unixTime)); } @JsonProperty("EndDate") public long getEndDateJson(){ return UnixDateTimeConverter.getUnix(endDate); } @JsonProperty("EndDate") public void setEndDateJson(long unixTime){ setEndDate(UnixDateTimeConverter.getDate(unixTime)); } public List<Integer> getImages() { return images; } public void setImages(List<Integer> images) { this.images = images; } public Integer getFirstImageId(){ return images.size() > 0 ? images.get(0) : -1; } public int getThumbnailId() { return thumbnailId; } public void setThumbnailId(int thumbnailId) { this.thumbnailId = thumbnailId; } public PeriodCategory getPeriodCategory() { return periodCategory; } public void setPeriodCategory(PeriodCategory periodCategory) { this.periodCategory = periodCategory; } @JsonProperty("PeriodCategory") public long getPeriodCategoryFlags(){ return periodCategory.getValue(); } @JsonProperty("PeriodCategory") public void setPeriodCategoryFlags(long value){ periodCategory = PeriodCategory.findCategory(value); } public List<String> getMonitors() { return monitors; } public void setMonitors(List<String> monitors) { this.monitors = monitors; } public int getFreeSpots() { return freeSpots; } public void setFreeSpots(int freeSpots) { this.freeSpots = freeSpots; } }