001/*
002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     <a href="mailto:grenard@nuxeo.com">Guillaume Renard</a>
018 *
019 */
020
021package org.nuxeo.theme.styling.service.descriptors;
022
023import org.nuxeo.common.xmap.annotation.XNode;
024import org.nuxeo.common.xmap.annotation.XObject;
025
026/**
027 * @since 7.4
028 */
029@XObject("variable")
030public class SassImport {
031
032    @XNode("@src")
033    String src;
034
035    /**
036     * Resolved source content
037     */
038    String content;
039
040    public SassImport clone() {
041        SassImport clone = new SassImport();
042        clone.setSrc(src);
043        clone.setContent(content);
044        return clone;
045    }
046
047    @Override
048    public boolean equals(Object obj) {
049        if (this == obj)
050            return true;
051        if (obj == null)
052            return false;
053        if (getClass() != obj.getClass())
054            return false;
055        SassImport other = (SassImport) obj;
056        if (src == null) {
057            if (other.src != null)
058                return false;
059        } else if (!src.equals(other.src))
060            return false;
061        return true;
062    }
063
064    public String getContent() {
065        return content;
066    }
067
068    public String getSrc() {
069        return src;
070    }
071
072    @Override
073    public int hashCode() {
074        final int prime = 31;
075        int result = 1;
076        result = prime * result + ((src == null) ? 0 : src.hashCode());
077        return result;
078    }
079
080    public void setContent(String content) {
081        this.content = content;
082    }
083
084    public void setSrc(String src) {
085        this.src = src;
086    }
087}