resourcedescriptor.java

来自「模块化您的应用系统」· Java 代码 · 共 77 行

JAVA
77
字号
package com.opensymphony.tonic.elements;

import org.dom4j.Element;

import java.util.Map;

import com.opensymphony.tonic.loaders.LoaderUtils;

public class ResourceDescriptor
{
    String type;
    String name;
    String location;
    private String content;
    private Map params;

    public ResourceDescriptor(Element element)
    {
        this.type = element.attributeValue("type");
        this.name = element.attributeValue("name");
        this.location = element.attributeValue("location");
        this.params = LoaderUtils.getParams(element);

        if (element.getTextTrim() != null && !"".equals(element.getTextTrim()))
        {
            content = element.getTextTrim();
        }
    }

    public String getType()
    {
        return type;
    }

    public String getName()
    {
        return name;
    }

    public String getLocation()
    {
        return location;
    }

    public String getContent()
    {
        return content;
    }


    public String getParameter(String key)
    {
        return (String) params.get(key);
    }

    public boolean equals(Object o)
    {
        if (this == o) return true;
        if (!(o instanceof ResourceDescriptor)) return false;

        final ResourceDescriptor resourceDescriptor = (ResourceDescriptor) o;

        if (!name.equals(resourceDescriptor.name)) return false;
        if (!type.equals(resourceDescriptor.type)) return false;

        return true;
    }

    public int hashCode()
    {
        int result;
        result = type.hashCode();
        result = 29 * result + name.hashCode();
        return result;
    }
}

⌨️ 快捷键说明

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