⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 service.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
字号:
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
 * This code is licensed under the GPL 2.0 license, availible at the root
 * application directory.
 */
package org.geoserver.platform;

import org.geotools.util.Version;


/**
 * A service descriptor which provides metadata such as id, and version.
 * <p>
 * Service descriptors are identified by an id, version pair. Two service
 * descriptors are considered equal if they have the same id, and version.
 * </p>
 * <p>
 * The underlying service implementation is a plain old java object,
 * available via {@link #service}.
 * </p>
 *
 * @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
 *
 */
public final class Service {
    /**
     * Identifier for the service.
     */
    final String id;

    /**
     * The service implementation.
     */
    final Object service;

    /**
     * The service version
     */
    final Version version;

    /**
     * Creates a new service descriptor.
     *
     * @param id A string identifing the service.
     * @param service The object implementing the service.
     * @param version The version of the service.
     */
    public Service(String id, Object service, Version version) {
        this.id = id;
        this.service = service;
        this.version = version;

        if (id == null) {
            throw new NullPointerException("id");
        }
    }

    public String getId() {
        return id;
    }

    public Object getService() {
        return service;
    }

    public Version getVersion() {
        return version;
    }

    public boolean equals(Object obj) {
        if (!(obj instanceof Service)) {
            return false;
        }

        Service other = (Service) obj;

        if (!id.equals(other.id)) {
            return false;
        }

        if (version == null) {
            if (other.version != null) {
                return false;
            }
        } else {
            if (!version.equals(other.version)) {
                return false;
            }
        }

        return true;
    }

    public int hashCode() {
        int result = 0;

        result = id.hashCode();

        if (version != null) {
            result = (result * 17) + version.hashCode();
        }

        return result;
    }

    public String toString() {
        return "Service( " + id + ", " + version + " )";
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -