All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.icthh.xm.commons.tenant.PlainTenant Maven / Gradle / Ivy

There is a newer version: 4.0.20
Show newest version
package com.icthh.xm.commons.tenant;

import java.util.Objects;

/**
 * The {@link PlainTenant} class.
 */
public class PlainTenant implements Tenant {

    private final TenantKey tenantKey;

    public PlainTenant(TenantKey tenantKey) {
        this.tenantKey = Objects.requireNonNull(tenantKey, "tenantKey can't be null");
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public TenantKey getTenantKey() {
        return tenantKey;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isSuper() {
        return tenantKey.isSuperTenant();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return "tenantKey = " + tenantKey;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (obj instanceof PlainTenant) {
            PlainTenant other = PlainTenant.class.cast(obj);
            return Objects.equals(this.tenantKey, other.tenantKey);
        }

        return false;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int hashCode() {
        return Objects.hash(tenantKey);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy