001/** 002 * Copyright (C) 2006-2025 Talend Inc. - www.talend.com 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 */ 016package org.talend.sdk.component.server.front.base.internal; 017 018import java.util.Locale; 019import java.util.Objects; 020 021public class RequestKey { 022 023 private final Locale locale; 024 025 private final boolean includeIconContent; 026 027 private final String query; 028 029 private final int cacheHash; 030 031 private final String theme; 032 033 public RequestKey(final Locale locale, final boolean includeIconContent, final String query, final String theme) { 034 this.locale = locale; 035 this.includeIconContent = includeIconContent; 036 this.query = query; 037 this.theme = theme; 038 this.cacheHash = Objects.hash(locale, includeIconContent, query, theme); 039 } 040 041 @Override 042 public boolean equals(final Object o) { 043 if (this == o) { 044 return true; 045 } 046 if (o == null || getClass() != o.getClass()) { 047 return false; 048 } 049 if (!super.equals(o)) { 050 return false; 051 } 052 final RequestKey that = RequestKey.class.cast(o); 053 return Objects.equals(locale, that.locale) && Objects.equals(includeIconContent, that.includeIconContent) 054 && Objects.equals(query, that.query) && Objects.equals(theme, that.theme); 055 } 056 057 @Override 058 public int hashCode() { 059 return cacheHash; 060 } 061}