diff --git a/src/main/java/org/gitlab4j/api/models/AbstractUser.java b/src/main/java/org/gitlab4j/api/models/AbstractUser.java index a76c625bf..80ff36330 100644 --- a/src/main/java/org/gitlab4j/api/models/AbstractUser.java +++ b/src/main/java/org/gitlab4j/api/models/AbstractUser.java @@ -10,7 +10,7 @@ @XmlAccessorType(XmlAccessType.FIELD) @JsonIgnoreProperties(ignoreUnknown = true) -public class AbstractUser { +public abstract class AbstractUser> { private String avatarUrl; private String bio; @@ -300,4 +300,197 @@ public List getCustomAttributes() { public void setCustomAttributes(List 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 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 customAttributes) { + this.customAttributes = customAttributes; + return (U)this; + } } diff --git a/src/main/java/org/gitlab4j/api/models/Assignee.java b/src/main/java/org/gitlab4j/api/models/Assignee.java index 5125c2465..4163ad243 100644 --- a/src/main/java/org/gitlab4j/api/models/Assignee.java +++ b/src/main/java/org/gitlab4j/api/models/Assignee.java @@ -4,5 +4,5 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement -public class Assignee extends AbstractUser { +public class Assignee extends AbstractUser { } diff --git a/src/main/java/org/gitlab4j/api/models/Author.java b/src/main/java/org/gitlab4j/api/models/Author.java index 31ef9e8a7..679c5b174 100644 --- a/src/main/java/org/gitlab4j/api/models/Author.java +++ b/src/main/java/org/gitlab4j/api/models/Author.java @@ -4,5 +4,5 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement -public class Author extends AbstractUser { +public class Author extends AbstractUser { } diff --git a/src/main/java/org/gitlab4j/api/models/Contributor.java b/src/main/java/org/gitlab4j/api/models/Contributor.java index 17ccaa41a..44272c644 100644 --- a/src/main/java/org/gitlab4j/api/models/Contributor.java +++ b/src/main/java/org/gitlab4j/api/models/Contributor.java @@ -3,5 +3,5 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement -public class Contributor extends AbstractUser { +public class Contributor extends AbstractUser { } \ No newline at end of file diff --git a/src/main/java/org/gitlab4j/api/models/Participant.java b/src/main/java/org/gitlab4j/api/models/Participant.java index a4a06ba16..1c78d6cf5 100644 --- a/src/main/java/org/gitlab4j/api/models/Participant.java +++ b/src/main/java/org/gitlab4j/api/models/Participant.java @@ -3,5 +3,5 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement -public class Participant extends AbstractUser { +public class Participant extends AbstractUser { } \ No newline at end of file diff --git a/src/main/java/org/gitlab4j/api/models/User.java b/src/main/java/org/gitlab4j/api/models/User.java index 80e01713d..8d1c8098b 100644 --- a/src/main/java/org/gitlab4j/api/models/User.java +++ b/src/main/java/org/gitlab4j/api/models/User.java @@ -1,10 +1,9 @@ package org.gitlab4j.api.models; import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; @XmlRootElement -public class User extends AbstractUser { +public class User extends AbstractUser { private String externUid; public void setExternUid(String externUid) { @@ -15,49 +14,13 @@ public String getExternUid() { return this.externUid; } - public User withEmail(String email) { - setEmail(email); - return this; - } - - 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; - } - + /** + * @deprecated Replaced by {@link #withProjectsLimit(Integer)} + * @see #withProjectsLimit(Integer) + */ + @Deprecated public User withProjectLimit(Integer projectsLimit) { - setProjectsLimit(projectsLimit); - return this; + return withProjectsLimit(projectsLimit); } public User withExternUid(String externUid) { @@ -65,48 +28,13 @@ public User withExternUid(String externUid) { return this; } - public User withProvider(String provider) { - setProvider(provider); - return this; - } - - 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; - } - + /** + * @deprecated Replaced by {@link #withSharedRunnersMinutesLimit(Integer)} + * @see #withSharedRunnersMinutesLimit(Integer) + */ + @Deprecated public User withSharedRunnersMinuteLimit(Integer sharedRunnersMinuteLimit) { - setSharedRunnersMinutesLimit(sharedRunnersMinuteLimit); - return this; + return withSharedRunnersMinutesLimit(sharedRunnersMinuteLimit); } - public User withCustomAttributes(List customAttributes) { - setCustomAttributes(customAttributes); - return this; - } }