Issue 191: hid incidental constructors

This commit is contained in:
Adrian Cole 2010-07-07 10:05:44 -07:00
parent a47a369d18
commit c948e49183
6 changed files with 18 additions and 21 deletions

View File

@ -47,7 +47,6 @@ public class CookbookVersion {
@SerializedName("root_files")
private Set<Resource> rootFiles = Sets.newLinkedHashSet();
// internal
@SuppressWarnings("unused")
@SerializedName("json_class")
@ -55,7 +54,7 @@ public class CookbookVersion {
@SerializedName("chef_type")
@SuppressWarnings("unused")
private String _chefType = "cookbook_version";
public CookbookVersion(String cookbookName, String version) {
this.cookbookName = cookbookName;
this.version = version;
@ -81,7 +80,8 @@ public class CookbookVersion {
Iterables.addAll(this.rootFiles, rootFiles);
}
public CookbookVersion() {
// hidden but needs to be here for json deserialization to work
CookbookVersion() {
}

View File

@ -34,11 +34,12 @@ public class Organization implements Comparable<Organization> {
private String clientname;
public Organization(String name) {
super();
this();
this.name = name;
}
public Organization() {
// hidden but needs to be here for json deserialization to work
Organization() {
super();
}

View File

@ -45,7 +45,8 @@ public class Resource {
this.specificity = specificity;
}
public Resource() {
// hidden but needs to be here for json deserialization to work
Resource() {
}
public String getName() {

View File

@ -42,7 +42,8 @@ public class User implements Comparable<User> {
this.username = username;
}
public User() {
// hidden but needs to be here for json deserialization to work
User() {
super();
}
@ -111,14 +112,11 @@ public class User implements Comparable<User> {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((displayName == null) ? 0 : displayName.hashCode());
result = prime * result + ((displayName == null) ? 0 : displayName.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result
+ ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result
+ ((middleName == null) ? 0 : middleName.hashCode());
result = prime * result + ((middleName == null) ? 0 : middleName.hashCode());
result = prime * result + ((password == null) ? 0 : password.hashCode());
result = prime * result + ((username == null) ? 0 : username.hashCode());
return result;
@ -173,10 +171,9 @@ public class User implements Comparable<User> {
@Override
public String toString() {
return "User [displayName=" + displayName + ", email=" + email
+ ", firstName=" + firstName + ", lastName=" + lastName
+ ", middleName=" + middleName + ", password=" + password
+ ", username=" + username + "]";
return "User [displayName=" + displayName + ", email=" + email + ", firstName=" + firstName
+ ", lastName=" + lastName + ", middleName=" + middleName + ", password=" + password
+ ", username=" + username + "]";
}
}

View File

@ -50,8 +50,7 @@ public class ParseOrganizationFromJsonTest {
public void test() {
Organization org = new Organization();
org.setName("opscode");
Organization org = new Organization("opscode");
org.setFullName("Opscode, Inc.");
org.setOrgType("Business");
org.setClientname("opscode-validator");

View File

@ -32,8 +32,7 @@ public class ParseUserFromJsonTest {
public void test() {
User user = new User();
user.setUsername("bobo");
User user = new User("bobo");
user.setFirstName("Bobo");
user.setMiddleName("Tiberion");
user.setLastName("Clown");