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.sonar; import java.io.Serializable; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; class SonarControllerRequest implements Serializable { static final long serialVersionUID = 1L; private String projectName = null; private String url = null; private String username = null; private String password = null; @Override public int hashCode() { HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); hashCodeBuilder.append(this.getPassword()); hashCodeBuilder.append(this.getProjectName()); hashCodeBuilder.append(this.getUrl()); hashCodeBuilder.append(this.getUsername()); return hashCodeBuilder.toHashCode(); } @Override public boolean equals(Object that) { if (that instanceof SonarControllerRequest) { SonarControllerRequest thatRequest = (SonarControllerRequest) that; EqualsBuilder equalsBuilder = new EqualsBuilder(); equalsBuilder.append(this.getPassword(), thatRequest.getPassword()); equalsBuilder.append(this.getProjectName(), thatRequest.getProjectName()); equalsBuilder.append(this.getUrl(), thatRequest.getUrl()); equalsBuilder.append(this.getUsername(), thatRequest.getUsername()); return equalsBuilder.isEquals(); } else { return false; } } // ------------------------------------------------------------------------- // --- Property access methods --------------------------------------------- // ------------------------------------------------------------------------- public String getProjectName() { return this.projectName; } public void setProjectName(String projectName) { this.projectName = projectName; } public String getUrl() { return this.url; } public void setUrl(String sonarUrl) { this.url = sonarUrl; } public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } }