Java tutorial
package com.jeans.iservlet.resource; import java.math.BigDecimal; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat.Shape; import com.jeans.iservlet.model.asset.Software; public class SoftwareResource extends BaseResource { protected long companyId; protected byte catalog; protected String vendor; protected String modelOrVersion; protected String assetUsage; protected Date purchaseTime; protected int quantity; protected BigDecimal cost; protected byte state; protected String comment; protected byte softwareType; protected String license; protected Date expiredTime; protected SoftwareResource() { super(); this.companyId = 0; this.catalog = 0; this.vendor = null; this.modelOrVersion = null; this.assetUsage = null; this.purchaseTime = null; this.quantity = 0; this.cost = new BigDecimal(0.0); this.state = 0; this.comment = null; this.softwareType = 0; this.license = null; this.expiredTime = null; } protected SoftwareResource(Software sw) { this.id = sw.getId(); this.name = sw.getName(); this.companyId = sw.getCompany().getId(); this.catalog = sw.getCatalog(); this.vendor = sw.getVendor(); this.modelOrVersion = sw.getModelOrVersion(); this.assetUsage = sw.getAssetUsage(); this.purchaseTime = sw.getPurchaseTime(); this.quantity = sw.getQuantity(); this.cost = sw.getCost(); this.state = sw.getState(); this.comment = sw.getComment(); this.softwareType = sw.getSoftwareType(); this.license = sw.getLicense(); this.expiredTime = sw.getExpiredTime(); } public long getCompanyId() { return companyId; } public void setCompanyId(long companyId) { this.companyId = companyId; } public byte getCatalog() { return catalog; } public void setCatalog(byte catalog) { this.catalog = catalog; } public String getVendor() { return vendor; } public void setVendor(String vendor) { this.vendor = vendor; } public String getModelOrVersion() { return modelOrVersion; } public void setModelOrVersion(String modelOrVersion) { this.modelOrVersion = modelOrVersion; } public String getAssetUsage() { return assetUsage; } public void setAssetUsage(String assetUsage) { this.assetUsage = assetUsage; } @JsonFormat(shape = Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8") public Date getPurchaseTime() { return purchaseTime; } public void setPurchaseTime(Date purchaseTime) { this.purchaseTime = purchaseTime; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public BigDecimal getCost() { return cost; } public void setCost(BigDecimal cost) { this.cost = cost; } public byte getState() { return state; } public void setState(byte state) { this.state = state; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public byte getSoftwareType() { return softwareType; } public void setSoftwareType(byte softwareType) { this.softwareType = softwareType; } public String getLicense() { return license; } public void setLicense(String license) { this.license = license; } @JsonFormat(shape = Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8") public Date getExpiredTime() { return expiredTime; } public void setExpiredTime(Date expiredTime) { this.expiredTime = expiredTime; } }