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    @Override
041    public SassImport clone() {
042        SassImport clone = new SassImport();
043        clone.setSrc(src);
044        clone.setContent(content);
045        return clone;
046    }
047
048    @Override
049    public boolean equals(Object obj) {
050        if (this == obj)
051            return true;
052        if (obj == null)
053            return false;
054        if (getClass() != obj.getClass())
055            return false;
056        SassImport other = (SassImport) obj;
057        if (src == null) {
058            if (other.src != null)
059                return false;
060        } else if (!src.equals(other.src))
061            return false;
062        return true;
063    }
064
065    public String getContent() {
066        return content;
067    }
068
069    public String getSrc() {
070        return src;
071    }
072
073    @Override
074    public int hashCode() {
075        final int prime = 31;
076        int result = 1;
077        result = prime * result + ((src == null) ? 0 : src.hashCode());
078        return result;
079    }
080
081    public void setContent(String content) {
082        this.content = content;
083    }
084
085    public void setSrc(String src) {
086        this.src = src;
087    }
088}