001/*
002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     <a href="mailto:grenard@nuxeo.com">Guillaume Renard</a>
016 *
017 */
018
019package org.nuxeo.theme.styling.service.descriptors;
020
021import org.nuxeo.common.xmap.annotation.XNode;
022import org.nuxeo.common.xmap.annotation.XObject;
023
024/**
025 * @since 7.4
026 */
027@XObject("variable")
028public class SassImport {
029
030    @XNode("@src")
031    String src;
032
033    /**
034     * Resolved source content
035     */
036    String content;
037
038    public SassImport clone() {
039        SassImport clone = new SassImport();
040        clone.setSrc(src);
041        clone.setContent(content);
042        return clone;
043    }
044
045    @Override
046    public boolean equals(Object obj) {
047        if (this == obj)
048            return true;
049        if (obj == null)
050            return false;
051        if (getClass() != obj.getClass())
052            return false;
053        SassImport other = (SassImport) obj;
054        if (src == null) {
055            if (other.src != null)
056                return false;
057        } else if (!src.equals(other.src))
058            return false;
059        return true;
060    }
061
062    public String getContent() {
063        return content;
064    }
065
066    public String getSrc() {
067        return src;
068    }
069
070    @Override
071    public int hashCode() {
072        final int prime = 31;
073        int result = 1;
074        result = prime * result + ((src == null) ? 0 : src.hashCode());
075        return result;
076    }
077
078    public void setContent(String content) {
079        this.content = content;
080    }
081
082    public void setSrc(String src) {
083        this.src = src;
084    }
085}