0% found this document useful (0 votes)
26 views

Classes LK

The document contains the code for 5 Java classes that define objects for an address, company, example user, and geographic coordinates. The classes establish getter and setter methods for serialized name and exposed properties.

Uploaded by

Lavish Kothari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Classes LK

The document contains the code for 5 Java classes that define objects for an address, company, example user, and geographic coordinates. The classes establish getter and setter methods for serialized name and exposed properties.

Uploaded by

Lavish Kothari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

-----------------------------------

com.example.Address.java-----------------------------------

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Address {

@SerializedName("street")
@Expose
private String street;
@SerializedName("suite")
@Expose
private String suite;
@SerializedName("city")
@Expose
private String city;
@SerializedName("zipcode")
@Expose
private String zipcode;
@SerializedName("geo")
@Expose
private Geo geo;

public String getStreet() {


return street;
}

public void setStreet(String street) {


this.street = street;
}

public String getSuite() {


return suite;
}

public void setSuite(String suite) {


this.suite = suite;
}

public String getCity() {


return city;
}

public void setCity(String city) {


this.city = city;
}

public String getZipcode() {


return zipcode;
}

public void setZipcode(String zipcode) {


this.zipcode = zipcode;
}

public Geo getGeo() {


return geo;
}

public void setGeo(Geo geo) {


this.geo = geo;
}

}
-----------------------------------
com.example.Company.java-----------------------------------

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Company {

@SerializedName("name")
@Expose
private String name;
@SerializedName("catchPhrase")
@Expose
private String catchPhrase;
@SerializedName("bs")
@Expose
private String bs;

public String getName() {


return name;
}

public void setName(String name) {


this.name = name;
}

public String getCatchPhrase() {


return catchPhrase;
}

public void setCatchPhrase(String catchPhrase) {


this.catchPhrase = catchPhrase;
}

public String getBs() {


return bs;
}

public void setBs(String bs) {


this.bs = bs;
}

}
-----------------------------------
com.example.Example.java-----------------------------------

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Example {

@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("username")
@Expose
private String username;
@SerializedName("email")
@Expose
private String email;
@SerializedName("address")
@Expose
private Address address;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("website")
@Expose
private String website;
@SerializedName("company")
@Expose
private Company company;

public Integer getId() {


return id;
}

public void setId(Integer id) {


this.id = id;
}

public String getName() {


return name;
}

public void setName(String name) {


this.name = name;
}

public String getUsername() {


return username;
}

public void setUsername(String username) {


this.username = username;
}

public String getEmail() {


return email;
}

public void setEmail(String email) {


this.email = email;
}

public Address getAddress() {


return address;
}

public void setAddress(Address address) {


this.address = address;
}

public String getPhone() {


return phone;
}

public void setPhone(String phone) {


this.phone = phone;
}

public String getWebsite() {


return website;
}

public void setWebsite(String website) {


this.website = website;
}

public Company getCompany() {


return company;
}

public void setCompany(Company company) {


this.company = company;
}

}
-----------------------------------
com.example.Geo.java-----------------------------------

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Geo {

@SerializedName("lat")
@Expose
private String lat;
@SerializedName("lng")
@Expose
private String lng;

public String getLat() {


return lat;
}

public void setLat(String lat) {


this.lat = lat;
}
public String getLng() {
return lng;
}

public void setLng(String lng) {


this.lng = lng;
}

You might also like