Java tutorial
/* * This file is part of dropwizard-curator. * * dropwizard-curator is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * dropwizard-curator 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with dropwizard-curator. If not, see <http://www.gnu.org/licenses/>. */ package com.pandich.dropwizard.curator; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Member; public final class ClassMember<A extends AccessibleObject & Member> { private final Class<? extends CuratorRootConfiguration> configurationClass; private final A member; public ClassMember(final Class<? extends CuratorRootConfiguration> configurationClass, final A member) { this.configurationClass = configurationClass; this.member = member; } public Class<? extends CuratorRootConfiguration> getConfigurationClass() { return configurationClass; } public A getMember() { return member; } @Override public int hashCode() { return new HashCodeBuilder(71, 7).append(this.configurationClass).append(this.member).build(); } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ClassMember)) { return false; } final ClassMember that = (ClassMember) o; return new EqualsBuilder().append(this.configurationClass, that.configurationClass) .append(this.member, that.member).build(); } }