Java tutorial
/* * Copyright 2015 Erwin Mller <erwin.mueller@deventm.org> * * This file is part of sscontrol-security-service. * * sscontrol-security-service is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * sscontrol-security-service is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License * for more details. * * You should have received a copy of the GNU Affero General Public License * along with sscontrol-security-service. If not, see <http://www.gnu.org/licenses/>. */ package com.anrisoftware.sscontrol.security.service; import java.io.Serializable; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; /** * Information that identifies the security service configuration. * * @author Erwin Mueller, erwin.mueller@deventm.org * @since 1.0 */ @SuppressWarnings("serial") public abstract class SecServiceInfo implements Serializable { private static final String SERVICE = "service"; /** * Returns the security service name. * <p> * The service name is the name of the security service. For example * <i>fail2ban</i>, <i>spamassassin</i>, etc. * * @return the service name. */ public abstract String getServiceName(); @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (!(obj instanceof SecServiceInfo)) { return false; } SecServiceInfo rhs = (SecServiceInfo) obj; return new EqualsBuilder().append(getServiceName(), rhs.getServiceName()).isEquals(); } @Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this); builder.append(SERVICE, getServiceName()); return builder.toString(); } }