patterntesting.sample.jfs2010.User Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of patterntesting-samples Show documentation
Show all versions of patterntesting-samples Show documentation
PatternTesting Samples (patterntesting-samples) is a collection of samples
how to use the PatternTesting framework. It uses patterntesting-rt,
patterntesting-check, patterntesting-concurrent and patterntesting-exception
to give you some ideas how to use it.
/*
* Copyright (c) 2010-2020 by Oliver Boehm
*
* 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 orimplied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* (c)reated 16.04.2010 by oliver ([email protected])
*/
package patterntesting.sample.jfs2010;
import org.apache.commons.lang3.StringUtils;
/**
* A simple user class.
*
* @author oliver
* @since 1.0 (16.04.2010)
*/
public final class User {
private String name;
/**
* Instantiates a new user.
*
* @param name the name
*/
public User(final String name) {
this.name = name;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets the name.
*
* @param name the name to set
*/
@Deprecated
public void setName(final String name) {
this.name = name;
}
/**
* To string.
*
* @return the string
* @see Object#toString()
*/
@Override
public String toString() {
return this.name;
}
/**
* Hash code.
*
* @return the int
* @see Object#hashCode()
*/
@Override
public int hashCode() {
return (name == null) ? 0 : name.hashCode();
}
/**
* Equals.
*
* @param obj the obj
* @return true, if successful
* @see Object#equals(Object)
*/
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof User)) {
return false;
}
User other = (User) obj;
return StringUtils.equals(this.name, other.name);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy