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

net.n2oapp.framework.api.register.SourceInfo Maven / Gradle / Ivy

There is a newer version: 7.28.1
Show newest version
package net.n2oapp.framework.api.register;

import net.n2oapp.framework.api.metadata.SourceMetadata;
import net.n2oapp.framework.api.reader.SourceLoader;
import net.n2oapp.framework.api.register.scan.MetadataScanner;

import java.io.Serializable;
import java.util.Objects;

/**
 * Информация о расположении метаданных
 */
public abstract class SourceInfo implements Serializable {
    protected String id;
    protected Class baseSourceClass;

    protected SourceInfo() {
    }

    public SourceInfo(String id,
                      Class baseSourceClass) {
        if (id == null)
            throw new IllegalArgumentException("Id must not be null");
        if (baseSourceClass == null)
            throw new IllegalArgumentException("BaseSourceClass must not be null");
        this.id = id;
        this.baseSourceClass = baseSourceClass;
    }

    public abstract Class getReaderClass();

    public abstract Class getScannerClass();

    public String getId() {
        return id;
    }

    public Class getBaseSourceClass() {
        return baseSourceClass;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SourceInfo)) return false;
        SourceInfo that = (SourceInfo) o;
        return Objects.equals(getId(), that.getId()) &&
                Objects.equals(getBaseSourceClass(), that.getBaseSourceClass());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getBaseSourceClass());
    }

    @Override
    public String toString() {
        return getId() + "." + getBaseSourceClass().getSimpleName();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy