Commit cab7f054 authored by mdeknowis's avatar mdeknowis Committed by Greg Messner
Browse files

Add withXxxxx() methods to AbstractUser (#273)

parent c9225298
...@@ -10,7 +10,7 @@ import javax.xml.bind.annotation.XmlAccessorType; ...@@ -10,7 +10,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class AbstractUser { public abstract class AbstractUser<U extends AbstractUser<U>> {
private String avatarUrl; private String avatarUrl;
private String bio; private String bio;
...@@ -300,4 +300,197 @@ public class AbstractUser { ...@@ -300,4 +300,197 @@ public class AbstractUser {
public void setCustomAttributes(List<CustomAttribute> customAttributes) { public void setCustomAttributes(List<CustomAttribute> customAttributes) {
this.customAttributes = customAttributes; this.customAttributes = customAttributes;
} }
@SuppressWarnings("unchecked")
public U withAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withBio(String bio) {
this.bio = bio;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withCanCreateGroup(Boolean canCreateGroup) {
this.canCreateGroup = canCreateGroup;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withCanCreateProject(Boolean canCreateProject) {
this.canCreateProject = canCreateProject;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withColorSchemeId(Integer colorSchemeId) {
this.colorSchemeId = colorSchemeId;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withConfirmedAt(Date confirmedAt) {
this.confirmedAt = confirmedAt;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withCreatedAt(Date createdAt) {
this.createdAt = createdAt;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withCurrentSignInAt(Date currentSignInAt) {
this.currentSignInAt = currentSignInAt;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withEmail(String email) {
this.email = email;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withExternal(Boolean external) {
this.external = external;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withId(Integer id) {
this.id = id;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withIdentities(List<Identity> identities) {
this.identities = identities;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withIsAdmin(Boolean isAdmin) {
this.isAdmin = isAdmin;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withLastActivityOn(Date lastActivityOn) {
this.lastActivityOn = lastActivityOn;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withLastSignInAt(Date lastSignInAt) {
this.lastSignInAt = lastSignInAt;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withLinkedin(String linkedin) {
this.linkedin = linkedin;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withLocation(String location) {
this.location = location;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withName(String name) {
this.name = name;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withOrganization(String organization) {
this.organization = organization;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withProjectsLimit(Integer projectsLimit) {
this.projectsLimit = projectsLimit;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withProvider(String provider) {
this.provider = provider;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withSharedRunnersMinutesLimit(Integer sharedRunnersMinutesLimit) {
this.sharedRunnersMinutesLimit = sharedRunnersMinutesLimit;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withSkype(String skype) {
this.skype = skype;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withState(String state) {
this.state = state;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withThemeId(Integer themeId) {
this.themeId = themeId;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withTwitter(String twitter) {
this.twitter = twitter;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withTwoFactorEnabled(Boolean twoFactorEnabled) {
this.twoFactorEnabled = twoFactorEnabled;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withUsername(String username) {
this.username = username;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withWebsiteUrl(String websiteUrl) {
this.websiteUrl = websiteUrl;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withWebUrl(String webUrl) {
this.webUrl = webUrl;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withSkipConfirmation(Boolean skipConfirmation) {
this.skipConfirmation = skipConfirmation;
return (U)this;
}
@SuppressWarnings("unchecked")
public U withCustomAttributes(List<CustomAttribute> customAttributes) {
this.customAttributes = customAttributes;
return (U)this;
}
} }
...@@ -4,5 +4,5 @@ package org.gitlab4j.api.models; ...@@ -4,5 +4,5 @@ package org.gitlab4j.api.models;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement @XmlRootElement
public class Assignee extends AbstractUser { public class Assignee extends AbstractUser<Assignee> {
} }
...@@ -4,5 +4,5 @@ package org.gitlab4j.api.models; ...@@ -4,5 +4,5 @@ package org.gitlab4j.api.models;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement @XmlRootElement
public class Author extends AbstractUser { public class Author extends AbstractUser<Author> {
} }
...@@ -3,5 +3,5 @@ package org.gitlab4j.api.models; ...@@ -3,5 +3,5 @@ package org.gitlab4j.api.models;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement @XmlRootElement
public class Contributor extends AbstractUser { public class Contributor extends AbstractUser<Contributor> {
} }
\ No newline at end of file
...@@ -3,5 +3,5 @@ package org.gitlab4j.api.models; ...@@ -3,5 +3,5 @@ package org.gitlab4j.api.models;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement @XmlRootElement
public class Participant extends AbstractUser { public class Participant extends AbstractUser<Participant> {
} }
\ No newline at end of file
package org.gitlab4j.api.models; package org.gitlab4j.api.models;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement @XmlRootElement
public class User extends AbstractUser { public class User extends AbstractUser<User> {
private String externUid; private String externUid;
public void setExternUid(String externUid) { public void setExternUid(String externUid) {
...@@ -15,49 +14,13 @@ public class User extends AbstractUser { ...@@ -15,49 +14,13 @@ public class User extends AbstractUser {
return this.externUid; return this.externUid;
} }
public User withEmail(String email) { /**
setEmail(email); * @deprecated Replaced by {@link #withProjectsLimit(Integer)}
return this; * @see #withProjectsLimit(Integer)
} */
@Deprecated
public User withName(String name) {
setName(name);
return this;
}
public User withUsername(String username) {
setUsername(username);
return this;
}
public User withSkype(String skype) {
setSkype(skype);
return this;
}
public User withLinkedin(String linkedIn) {
setLinkedin(linkedIn);
return this;
}
public User withTwitter(String twitter) {
setTwitter(twitter);
return this;
}
public User withWebsiteUrl(String websiteUrl) {
setWebsiteUrl(websiteUrl);
return this;
}
public User withOrganization(String organization) {
setOrganization(organization);
return this;
}
public User withProjectLimit(Integer projectsLimit) { public User withProjectLimit(Integer projectsLimit) {
setProjectsLimit(projectsLimit); return withProjectsLimit(projectsLimit);
return this;
} }
public User withExternUid(String externUid) { public User withExternUid(String externUid) {
...@@ -65,48 +28,13 @@ public class User extends AbstractUser { ...@@ -65,48 +28,13 @@ public class User extends AbstractUser {
return this; return this;
} }
public User withProvider(String provider) { /**
setProvider(provider); * @deprecated Replaced by {@link #withSharedRunnersMinutesLimit(Integer)}
return this; * @see #withSharedRunnersMinutesLimit(Integer)
} */
@Deprecated
public User withBio(String bio) {
setBio(bio);
return this;
}
public User withLocation(String location) {
setLocation(location);
return this;
}
public User withIsAdmin(Boolean isAdmin) {
setIsAdmin(isAdmin);
return this;
}
public User withCanCreateGroup(Boolean canCreateGroup) {
setCanCreateGroup(canCreateGroup);
return this;
}
public User withSkipConfirmation(Boolean skipConfirmation) {
setSkipConfirmation(skipConfirmation);
return this;
}
public User withExternal(Boolean external) {
setExternal(external);
return this;
}
public User withSharedRunnersMinuteLimit(Integer sharedRunnersMinuteLimit) { public User withSharedRunnersMinuteLimit(Integer sharedRunnersMinuteLimit) {
setSharedRunnersMinutesLimit(sharedRunnersMinuteLimit); return withSharedRunnersMinutesLimit(sharedRunnersMinuteLimit);
return this;
} }
public User withCustomAttributes(List<CustomAttribute> customAttributes) {
setCustomAttributes(customAttributes);
return this;
}
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment