Java tutorial
/* * Dashboard * Copyright 2014 Christian Robert * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.perdian.apps.dashboard.mvc.modules.project; import java.io.Serializable; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; class ProjectControllerRequest implements Serializable { static final long serialVersionUID = 1L; private String jenkinsJobName = null; private String jenkinsUrl = null; private String jenkinsUsername = null; private String jenkinsPassword = null; private String sonarProjectName = null; private String sonarUrl = null; private String sonarUsername = null; private String sonarPassword = null; @Override public int hashCode() { HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); hashCodeBuilder.append(this.getJenkinsJobName()); hashCodeBuilder.append(this.getJenkinsPassword()); hashCodeBuilder.append(this.getJenkinsUrl()); hashCodeBuilder.append(this.getJenkinsUsername()); hashCodeBuilder.append(this.getSonarPassword()); hashCodeBuilder.append(this.getSonarProjectName()); hashCodeBuilder.append(this.getSonarUrl()); hashCodeBuilder.append(this.getSonarUsername()); return hashCodeBuilder.toHashCode(); } @Override public boolean equals(Object that) { if (that instanceof ProjectControllerRequest) { ProjectControllerRequest thatRequest = (ProjectControllerRequest) that; EqualsBuilder equalsBuilder = new EqualsBuilder(); equalsBuilder.append(this.getJenkinsJobName(), thatRequest.getJenkinsJobName()); equalsBuilder.append(this.getJenkinsPassword(), thatRequest.getJenkinsPassword()); equalsBuilder.append(this.getJenkinsUrl(), thatRequest.getJenkinsUrl()); equalsBuilder.append(this.getJenkinsUsername(), thatRequest.getJenkinsUsername()); equalsBuilder.append(this.getSonarPassword(), thatRequest.getSonarPassword()); equalsBuilder.append(this.getSonarProjectName(), thatRequest.getSonarProjectName()); equalsBuilder.append(this.getSonarUrl(), thatRequest.getSonarUrl()); equalsBuilder.append(this.getSonarUsername(), thatRequest.getSonarUsername()); return equalsBuilder.isEquals(); } else { return false; } } // ------------------------------------------------------------------------- // --- Property access methods --------------------------------------------- // ------------------------------------------------------------------------- public String getJenkinsJobName() { return this.jenkinsJobName; } public void setJenkinsJobName(String jenkinsJobName) { this.jenkinsJobName = jenkinsJobName; } public String getJenkinsUrl() { return this.jenkinsUrl; } public void setJenkinsUrl(String jenkinsUrl) { this.jenkinsUrl = jenkinsUrl; } public String getJenkinsUsername() { return this.jenkinsUsername; } public void setJenkinsUsername(String jenkinsUsername) { this.jenkinsUsername = jenkinsUsername; } public String getJenkinsPassword() { return this.jenkinsPassword; } public void setJenkinsPassword(String jenkinsPassword) { this.jenkinsPassword = jenkinsPassword; } public String getSonarProjectName() { return this.sonarProjectName; } public void setSonarProjectName(String sonarProjectName) { this.sonarProjectName = sonarProjectName; } public String getSonarUrl() { return this.sonarUrl; } public void setSonarUrl(String sonarUrl) { this.sonarUrl = sonarUrl; } public String getSonarUsername() { return this.sonarUsername; } public void setSonarUsername(String sonarUsername) { this.sonarUsername = sonarUsername; } public String getSonarPassword() { return this.sonarPassword; } public void setSonarPassword(String sonarPassword) { this.sonarPassword = sonarPassword; } }