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

com.webank.wecross.stub.ResourceInfo Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.webank.wecross.stub;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class ResourceInfo {
    private String name;
    private String stubType;
    private Map properties = new HashMap();
    private String checksum;

    public static boolean isEqualInfos(Map a, Map b) {
        if (a.size() != b.size()) {
            return false;
        }

        for (Map.Entry info : a.entrySet()) {
            ResourceInfo bInfo = b.get(info.getKey());
            if (bInfo == null) {
                return false;
            }

            if (!info.getValue().equals(bInfo)) {
                return false;
            }
        }
        return true;
    }

    @Override
    public int hashCode() {
        int result = 17;
        result = result * 31 + (this.name == null ? 0 : this.name.hashCode());
        result = result * 31 + (this.checksum == null ? 0 : this.checksum.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        try {
            if (obj == this) {
                return true;
            }
            if (!(obj instanceof ResourceInfo)) {
                return false;
            }

            ResourceInfo info = (ResourceInfo) obj;
            // no need to check distance
            return info.name.equals(this.name) && Objects.equals(info.checksum, this.checksum);

        } catch (Exception e) {
            return false;
        }
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public String getStubType() {
        return stubType;
    }

    public void setStubType(String driverType) {
        this.stubType = driverType;
    }

    public Map getProperties() {
        return properties;
    }

    public void setProperties(Map properties) {
        this.properties = properties;
    }

    public void setChecksum(String checksum) {
        this.checksum = checksum;
    }

    public String getChecksum() {
        return checksum;
    }

    @Override
    public String toString() {
        return "ResourceInfo{"
                + "name='"
                + name
                + '\''
                + ", stubType='"
                + stubType
                + '\''
                + ", properties="
                + properties
                + ", checksum='"
                + checksum
                + '\''
                + '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy