All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.soabase.admin.components.TabComponent Maven / Gradle / Ivy

There is a newer version: 0.11.2
Show newest version
/**
 * Copyright 2014 Jordan Zimmerman
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.soabase.admin.components;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.util.List;

public class TabComponent implements ComponentId
{
    private final String id;
    private final String name;
    private final String contentResourcePath;
    private final List javascriptUris;
    private final List cssUris;
    private final List assetsPaths;

    TabComponent(String id)
    {
        this.id = id;
        name = null;
        contentResourcePath = null;
        javascriptUris = null;
        cssUris = null;
        assetsPaths = null;
    }

    TabComponent(String id, String name, String contentResourcePath, List javascriptUris, List cssUris, List assetsPaths)
    {
        this.id = Preconditions.checkNotNull(id, "id cannot be null");
        this.name = Preconditions.checkNotNull(name, "name cannot be null");
        this.contentResourcePath = Preconditions.checkNotNull(contentResourcePath, "contentResourcePath cannot be null");
        javascriptUris = Preconditions.checkNotNull(javascriptUris, "javascriptUris cannot be null");
        cssUris = Preconditions.checkNotNull(cssUris, "cssUris cannot be null");
        assetsPaths = Preconditions.checkNotNull(assetsPaths, "assetsPaths cannot be null");
        this.javascriptUris = ImmutableList.copyOf(javascriptUris);
        this.cssUris = ImmutableList.copyOf(cssUris);
        this.assetsPaths = ImmutableList.copyOf(assetsPaths);
    }

    @Override
    public String getId()
    {
        return id;
    }

    public String getName()
    {
        return name;
    }

    public String getContentResourcePath()
    {
        return contentResourcePath;
    }

    public List getJavascriptUris()
    {
        return javascriptUris;
    }

    public List getCssUris()
    {
        return cssUris;
    }

    public List getAssetsPaths()
    {
        return assetsPaths;
    }

    @Override
    public boolean equals(Object o)
    {
        if ( this == o )
        {
            return true;
        }
        if ( o == null || getClass() != o.getClass() )
        {
            return false;
        }

        TabComponent component = (TabComponent)o;

        if ( !assetsPaths.equals(component.assetsPaths) )
        {
            return false;
        }
        if ( !contentResourcePath.equals(component.contentResourcePath) )
        {
            return false;
        }
        if ( !cssUris.equals(component.cssUris) )
        {
            return false;
        }
        if ( !id.equals(component.id) )
        {
            return false;
        }
        if ( !javascriptUris.equals(component.javascriptUris) )
        {
            return false;
        }
        //noinspection RedundantIfStatement
        if ( !name.equals(component.name) )
        {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode()
    {
        int result = id.hashCode();
        result = 31 * result + name.hashCode();
        result = 31 * result + contentResourcePath.hashCode();
        result = 31 * result + javascriptUris.hashCode();
        result = 31 * result + cssUris.hashCode();
        result = 31 * result + assetsPaths.hashCode();
        return result;
    }

    @Override
    public String toString()
    {
        return "TabComponent{" +
            "id='" + id + '\'' +
            ", name='" + name + '\'' +
            ", contentResourcePath='" + contentResourcePath + '\'' +
            ", javascriptUriPaths=" + javascriptUris +
            ", cssUriPaths=" + cssUris +
            ", assetsPaths=" + assetsPaths +
            '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy