org.jnosql.artemis.configuration.DefaultConfigurationSettingsUnit Maven / Gradle / Ivy
/*
* Copyright (c) 2017 Otávio Santana and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana
*/
package org.jnosql.artemis.configuration;
import org.jnosql.artemis.ConfigurationSettingsUnit;
import org.jnosql.diana.api.Settings;
import java.util.Objects;
import java.util.Optional;
import static java.util.Optional.ofNullable;
/**
* The default implementation of {@link ConfigurationSettingsUnit}
*/
class DefaultConfigurationSettingsUnit implements ConfigurationSettingsUnit {
private final String name;
private final String description;
private final Class> provider;
private final Settings settings;
DefaultConfigurationSettingsUnit(String name, String description, Class> provider, Settings settings) {
this.name = name;
this.description = description;
this.provider = provider;
this.settings = settings;
}
@Override
public Optional getName() {
return ofNullable(name);
}
@Override
public Optional getDescription() {
return ofNullable(description);
}
@Override
public Optional> getProvider() {
return ofNullable((Class) provider);
}
@Override
public Settings getSettings() {
return settings;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DefaultConfigurationSettingsUnit)) {
return false;
}
DefaultConfigurationSettingsUnit that = (DefaultConfigurationSettingsUnit) o;
return Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hashCode(name);
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("DefaultConfigurationSettingsUnit{");
sb.append("name='").append(name).append('\'');
sb.append(", description='").append(description).append('\'');
sb.append(", provider=").append(provider);
sb.append(", settings=").append(settings);
sb.append('}');
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy