001// Copyright 2022 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007// http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014package org.apache.tapestry5.internal.services;
015
016import java.util.Objects;
017
018import org.apache.tapestry5.commons.Resource;
019
020/**
021 * Class that holds information about a messages properties file for tracking.
022 */
023final public class MessagesTrackingInfo implements ClassNameHolder
024{
025    
026    private Object bundleId;
027    private Resource resource;
028    private String className;
029
030    public MessagesTrackingInfo(Resource resource, Object bundleId, String className) 
031    {
032        super();
033        this.resource = resource;
034        this.className = className;
035        this.bundleId = bundleId;
036    }
037    
038    public Object getBundleId() 
039    {
040        return bundleId;
041    }
042    
043    public Resource getResource() 
044    {
045        return resource;
046    }
047    
048    public String getClassName() 
049    {
050        return className;
051    }
052
053    @Override
054    public int hashCode()
055    {
056        return Objects.hash(bundleId, className, resource);
057    }
058
059    @Override
060    public boolean equals(Object obj)
061    {
062        if (this == obj)
063            return true;
064        if (obj == null)
065            return false;
066        if (getClass() != obj.getClass())
067            return false;
068        MessagesTrackingInfo other = (MessagesTrackingInfo) obj;
069        return Objects.equals(bundleId, other.bundleId)
070                && Objects.equals(className, other.className)
071                && Objects.equals(resource, other.resource);
072    }
073
074    @Override
075    public String toString()
076    {
077        return "MessagesTrackingInfo [resource=" + resource + ", className=" + className
078                + ", bundleId=" + bundleId + "]";
079    }
080    
081}