mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-06 15:44:49 +08:00
Fixed some code smells:
- private constructor for DebugChannels, RedisCheck, VersionInfoLoader - shortened RedisCheck code to use Check - InfoRequests delegation instead of extension of HashMap to avoid serialization issues. - Moved InfoRequestHandlerFactory inside InfoRequestFactory.Handlers to avoid duplicate constructor and variable pointers. - Removed Lazy call to itself from the constructor - equals+hashcode to StackDataSet, ErrorResponse - Refactored a while loop in VersionInfoLoader to not have two continue statements
This commit is contained in:
parent
40585d70b2
commit
06565c0c83
@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.system.info.server.properties;
|
package com.djrapitops.plan.system.info.server.properties;
|
||||||
|
|
||||||
|
import com.djrapitops.plugin.api.Check;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for checking if RedisBungee API is available.
|
* Utility class for checking if RedisBungee API is available.
|
||||||
*
|
*
|
||||||
@ -23,13 +25,12 @@ package com.djrapitops.plan.system.info.server.properties;
|
|||||||
*/
|
*/
|
||||||
public class RedisCheck {
|
public class RedisCheck {
|
||||||
|
|
||||||
|
private RedisCheck() {
|
||||||
|
/* Static method class */
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isClassAvailable() {
|
public static boolean isClassAvailable() {
|
||||||
try {
|
return Check.isAvailable("com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI");
|
||||||
Class.forName("com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI");
|
|
||||||
return true;
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -23,6 +23,10 @@ package com.djrapitops.plan.system;
|
|||||||
*/
|
*/
|
||||||
public class DebugChannels {
|
public class DebugChannels {
|
||||||
|
|
||||||
|
private DebugChannels() {
|
||||||
|
/* Static variable class */
|
||||||
|
}
|
||||||
|
|
||||||
public static final String ANALYSIS = "Analysis";
|
public static final String ANALYSIS = "Analysis";
|
||||||
public static final String INFO_REQUESTS = "InfoRequests";
|
public static final String INFO_REQUESTS = "InfoRequests";
|
||||||
public static final String CONNECTIONS = "Connections";
|
public static final String CONNECTIONS = "Connections";
|
||||||
|
@ -47,7 +47,6 @@ public class InfoRequestFactory {
|
|||||||
private final Lazy<InfoSystem> infoSystem;
|
private final Lazy<InfoSystem> infoSystem;
|
||||||
private final Lazy<ConnectionSystem> connectionSystem;
|
private final Lazy<ConnectionSystem> connectionSystem;
|
||||||
private final Lazy<ServerInfo> serverInfo;
|
private final Lazy<ServerInfo> serverInfo;
|
||||||
private final Lazy<InfoRequestFactory> infoRequestFactory;
|
|
||||||
private final Lazy<ResponseFactory> responseFactory;
|
private final Lazy<ResponseFactory> responseFactory;
|
||||||
private final Lazy<PageFactory> pageFactory;
|
private final Lazy<PageFactory> pageFactory;
|
||||||
private final Lazy<HtmlExport> htmlExport;
|
private final Lazy<HtmlExport> htmlExport;
|
||||||
@ -62,7 +61,6 @@ public class InfoRequestFactory {
|
|||||||
Lazy<InfoSystem> infoSystem,
|
Lazy<InfoSystem> infoSystem,
|
||||||
Lazy<ConnectionSystem> connectionSystem,
|
Lazy<ConnectionSystem> connectionSystem,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
Lazy<InfoRequestFactory> infoRequestFactory,
|
|
||||||
Lazy<ResponseFactory> responseFactory,
|
Lazy<ResponseFactory> responseFactory,
|
||||||
Lazy<PageFactory> pageFactory,
|
Lazy<PageFactory> pageFactory,
|
||||||
Lazy<HtmlExport> htmlExport,
|
Lazy<HtmlExport> htmlExport,
|
||||||
@ -75,7 +73,6 @@ public class InfoRequestFactory {
|
|||||||
this.infoSystem = infoSystem;
|
this.infoSystem = infoSystem;
|
||||||
this.connectionSystem = connectionSystem;
|
this.connectionSystem = connectionSystem;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
this.infoRequestFactory = infoRequestFactory;
|
|
||||||
this.responseFactory = responseFactory;
|
this.responseFactory = responseFactory;
|
||||||
this.pageFactory = pageFactory;
|
this.pageFactory = pageFactory;
|
||||||
this.htmlExport = htmlExport;
|
this.htmlExport = htmlExport;
|
||||||
@ -100,7 +97,7 @@ public class InfoRequestFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GenerateRequest generateAnalysisPageRequest(UUID serverUUID) {
|
public GenerateRequest generateAnalysisPageRequest(UUID serverUUID) {
|
||||||
return new GenerateAnalysisPageRequest(serverUUID, infoRequestFactory.get(), serverInfo.get(), infoSystem.get(), pageFactory.get());
|
return new GenerateAnalysisPageRequest(serverUUID, this, serverInfo.get(), infoSystem.get(), pageFactory.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenerateRequest generateInspectPageRequest(UUID uuid) {
|
public GenerateRequest generateInspectPageRequest(UUID uuid) {
|
||||||
@ -122,4 +119,88 @@ public class InfoRequestFactory {
|
|||||||
public CheckConnectionRequest checkConnectionRequest(String webAddress) {
|
public CheckConnectionRequest checkConnectionRequest(String webAddress) {
|
||||||
return new CheckConnectionRequest(webAddress, connectionSystem.get());
|
return new CheckConnectionRequest(webAddress, connectionSystem.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public static class Handlers {
|
||||||
|
|
||||||
|
private final InfoRequestFactory factory;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public Handlers(InfoRequestFactory factory) {
|
||||||
|
this.factory = factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheRequest cacheAnalysisPageRequest() {
|
||||||
|
return new CacheAnalysisPageRequest(
|
||||||
|
factory.config.get(),
|
||||||
|
factory.processing.get(),
|
||||||
|
factory.htmlExport.get(),
|
||||||
|
factory.serverInfo.get().getServerUUID()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheRequest cacheInspectPageRequest() {
|
||||||
|
return new CacheInspectPageRequest(
|
||||||
|
factory.config.get(),
|
||||||
|
factory.processing.get(),
|
||||||
|
factory.serverInfo.get(),
|
||||||
|
factory.htmlExport.get()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheRequest cacheInspectPluginsTabRequest() {
|
||||||
|
return new CacheInspectPluginsTabRequest(factory.serverInfo.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheRequest cacheNetworkPageContentRequest() {
|
||||||
|
return new CacheNetworkPageContentRequest(factory.serverInfo.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckConnectionRequest checkConnectionRequest() {
|
||||||
|
return new CheckConnectionRequest(factory.connectionSystem.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
GenerateRequest generateAnalysisPageRequest() {
|
||||||
|
return new GenerateAnalysisPageRequest(
|
||||||
|
factory,
|
||||||
|
factory.serverInfo.get(),
|
||||||
|
factory.infoSystem.get(),
|
||||||
|
factory.pageFactory.get()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
GenerateRequest generateInspectPageRequest() {
|
||||||
|
return new GenerateInspectPageRequest(
|
||||||
|
factory,
|
||||||
|
factory.responseFactory.get(),
|
||||||
|
factory.pageFactory.get(),
|
||||||
|
factory.infoSystem.get()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
GenerateRequest generateInspectPluginsTabRequest() {
|
||||||
|
return new GenerateInspectPluginsTabRequest(
|
||||||
|
factory.infoSystem.get(),
|
||||||
|
factory,
|
||||||
|
factory.pageFactory.get()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetupRequest saveDBSettingsRequest() {
|
||||||
|
return new SaveDBSettingsRequest(
|
||||||
|
factory.plugin.get(),
|
||||||
|
factory.config.get(),
|
||||||
|
factory.logger.get(),
|
||||||
|
factory.runnableFactory.get()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetupRequest sendDBSettingsRequest() {
|
||||||
|
return new SendDBSettingsRequest(
|
||||||
|
factory.config.get(),
|
||||||
|
factory,
|
||||||
|
factory.connectionSystem.get()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,124 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Player Analytics (Plan).
|
|
||||||
*
|
|
||||||
* Plan is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Plan is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.djrapitops.plan.system.info.request;
|
|
||||||
|
|
||||||
import com.djrapitops.plan.PlanPlugin;
|
|
||||||
import com.djrapitops.plan.system.info.InfoSystem;
|
|
||||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
|
||||||
import com.djrapitops.plan.system.processing.Processing;
|
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
|
||||||
import com.djrapitops.plan.system.webserver.response.ResponseFactory;
|
|
||||||
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
|
||||||
import com.djrapitops.plan.utilities.html.pages.PageFactory;
|
|
||||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
|
||||||
import com.djrapitops.plugin.task.RunnableFactory;
|
|
||||||
import dagger.Lazy;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Factory for {@link InfoRequest} objects that are used for handling received requests.
|
|
||||||
*
|
|
||||||
* @author Rsl1122
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class InfoRequestHandlerFactory {
|
|
||||||
|
|
||||||
private final Lazy<PlanPlugin> plugin;
|
|
||||||
private final Lazy<PlanConfig> config;
|
|
||||||
private final Lazy<Processing> processing;
|
|
||||||
private final Lazy<InfoSystem> infoSystem;
|
|
||||||
private final Lazy<ConnectionSystem> connectionSystem;
|
|
||||||
private final Lazy<ServerInfo> serverInfo;
|
|
||||||
private final Lazy<InfoRequestFactory> infoRequestFactory;
|
|
||||||
private final Lazy<ResponseFactory> responseFactory;
|
|
||||||
private final Lazy<PageFactory> pageFactory;
|
|
||||||
private final Lazy<HtmlExport> htmlExport;
|
|
||||||
private final Lazy<PluginLogger> logger;
|
|
||||||
private final Lazy<RunnableFactory> runnableFactory;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public InfoRequestHandlerFactory(
|
|
||||||
Lazy<PlanPlugin> plugin,
|
|
||||||
Lazy<PlanConfig> config,
|
|
||||||
Lazy<Processing> processing,
|
|
||||||
Lazy<InfoSystem> infoSystem,
|
|
||||||
Lazy<ConnectionSystem> connectionSystem,
|
|
||||||
Lazy<ServerInfo> serverInfo,
|
|
||||||
Lazy<InfoRequestFactory> infoRequestFactory,
|
|
||||||
Lazy<ResponseFactory> responseFactory,
|
|
||||||
Lazy<PageFactory> pageFactory,
|
|
||||||
Lazy<HtmlExport> htmlExport,
|
|
||||||
Lazy<PluginLogger> logger,
|
|
||||||
Lazy<RunnableFactory> runnableFactory
|
|
||||||
) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.config = config;
|
|
||||||
this.processing = processing;
|
|
||||||
this.infoSystem = infoSystem;
|
|
||||||
this.connectionSystem = connectionSystem;
|
|
||||||
this.serverInfo = serverInfo;
|
|
||||||
this.infoRequestFactory = infoRequestFactory;
|
|
||||||
this.responseFactory = responseFactory;
|
|
||||||
this.pageFactory = pageFactory;
|
|
||||||
this.htmlExport = htmlExport;
|
|
||||||
this.logger = logger;
|
|
||||||
this.runnableFactory = runnableFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
CacheRequest cacheAnalysisPageRequest() {
|
|
||||||
return new CacheAnalysisPageRequest(config.get(), processing.get(), htmlExport.get(), serverInfo.get().getServerUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
CacheRequest cacheInspectPageRequest() {
|
|
||||||
return new CacheInspectPageRequest(config.get(), processing.get(), serverInfo.get(), htmlExport.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
CacheRequest cacheInspectPluginsTabRequest() {
|
|
||||||
return new CacheInspectPluginsTabRequest(serverInfo.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
CacheRequest cacheNetworkPageContentRequest() {
|
|
||||||
return new CacheNetworkPageContentRequest(serverInfo.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckConnectionRequest checkConnectionRequest() {
|
|
||||||
return new CheckConnectionRequest(connectionSystem.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
GenerateRequest generateAnalysisPageRequest() {
|
|
||||||
return new GenerateAnalysisPageRequest(infoRequestFactory.get(), serverInfo.get(), infoSystem.get(), pageFactory.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
GenerateRequest generateInspectPageRequest() {
|
|
||||||
return new GenerateInspectPageRequest(infoRequestFactory.get(), responseFactory.get(), pageFactory.get(), infoSystem.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
GenerateRequest generateInspectPluginsTabRequest() {
|
|
||||||
return new GenerateInspectPluginsTabRequest(infoSystem.get(), infoRequestFactory.get(), pageFactory.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
SetupRequest saveDBSettingsRequest() {
|
|
||||||
return new SaveDBSettingsRequest(plugin.get(), config.get(), logger.get(), runnableFactory.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
SetupRequest sendDBSettingsRequest() {
|
|
||||||
return new SendDBSettingsRequest(config.get(), infoRequestFactory.get(), connectionSystem.get());
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,6 +19,7 @@ package com.djrapitops.plan.system.info.request;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map object that holds {@link InfoRequest} objects used for handling incoming requests.
|
* Map object that holds {@link InfoRequest} objects used for handling incoming requests.
|
||||||
@ -28,31 +29,42 @@ import java.util.HashMap;
|
|||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InfoRequests extends HashMap<String, InfoRequest> {
|
public class InfoRequests {
|
||||||
|
|
||||||
private final InfoRequestHandlerFactory handlers;
|
private final InfoRequestFactory.Handlers handlerFactory;
|
||||||
|
|
||||||
|
private final Map<String, InfoRequest> requestHandlers;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InfoRequests(InfoRequestHandlerFactory handlers) {
|
public InfoRequests(InfoRequestFactory.Handlers handlerFactory) {
|
||||||
this.handlers = handlers;
|
this.handlerFactory = handlerFactory;
|
||||||
|
this.requestHandlers = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeRequests() {
|
public void initializeRequests() {
|
||||||
putRequest(handlers.cacheAnalysisPageRequest());
|
putRequest(handlerFactory.cacheAnalysisPageRequest());
|
||||||
putRequest(handlers.cacheInspectPageRequest());
|
putRequest(handlerFactory.cacheInspectPageRequest());
|
||||||
putRequest(handlers.cacheInspectPluginsTabRequest());
|
putRequest(handlerFactory.cacheInspectPluginsTabRequest());
|
||||||
putRequest(handlers.cacheNetworkPageContentRequest());
|
putRequest(handlerFactory.cacheNetworkPageContentRequest());
|
||||||
|
|
||||||
putRequest(handlers.generateAnalysisPageRequest());
|
putRequest(handlerFactory.generateAnalysisPageRequest());
|
||||||
putRequest(handlers.generateInspectPageRequest());
|
putRequest(handlerFactory.generateInspectPageRequest());
|
||||||
putRequest(handlers.generateInspectPluginsTabRequest());
|
putRequest(handlerFactory.generateInspectPluginsTabRequest());
|
||||||
|
|
||||||
putRequest(handlers.saveDBSettingsRequest());
|
putRequest(handlerFactory.saveDBSettingsRequest());
|
||||||
putRequest(handlers.sendDBSettingsRequest());
|
putRequest(handlerFactory.sendDBSettingsRequest());
|
||||||
putRequest(handlers.checkConnectionRequest());
|
putRequest(handlerFactory.checkConnectionRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void putRequest(InfoRequest request) {
|
private void putRequest(InfoRequest request) {
|
||||||
put(request.getClass().getSimpleName().toLowerCase(), request);
|
requestHandlers.put(request.getClass().getSimpleName().toLowerCase(), request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InfoRequest get(String name) {
|
||||||
|
return requestHandlers.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
requestHandlers.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,10 +20,7 @@ import com.djrapitops.plugin.api.utility.Version;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility for loading version information from github.
|
* Utility for loading version information from github.
|
||||||
@ -35,6 +32,10 @@ public class VersionInfoLoader {
|
|||||||
private static final String VERSION_TXT_URL =
|
private static final String VERSION_TXT_URL =
|
||||||
"https://raw.githubusercontent.com/Rsl1122/Plan-PlayerAnalytics/master/versions.txt";
|
"https://raw.githubusercontent.com/Rsl1122/Plan-PlayerAnalytics/master/versions.txt";
|
||||||
|
|
||||||
|
private VersionInfoLoader() {
|
||||||
|
/* Static method class */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads version information from github.
|
* Loads version information from github.
|
||||||
*
|
*
|
||||||
@ -49,20 +50,14 @@ public class VersionInfoLoader {
|
|||||||
|
|
||||||
try (Scanner websiteScanner = new Scanner(url.openStream())) {
|
try (Scanner websiteScanner = new Scanner(url.openStream())) {
|
||||||
while (websiteScanner.hasNextLine()) {
|
while (websiteScanner.hasNextLine()) {
|
||||||
String line = websiteScanner.nextLine();
|
checkLine(websiteScanner).ifPresent(lineParts -> {
|
||||||
if (!line.startsWith("REL") && !line.startsWith("DEV")) {
|
boolean release = lineParts[0].equals("REL");
|
||||||
continue;
|
Version version = new Version(lineParts[1]);
|
||||||
}
|
String downloadUrl = lineParts[2];
|
||||||
String[] parts = line.split("\\|");
|
String changeLogUrl = lineParts[3];
|
||||||
if (parts.length < 4) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
boolean release = parts[0].equals("REL");
|
|
||||||
Version version = new Version(parts[1]);
|
|
||||||
String downloadUrl = parts[2];
|
|
||||||
String changeLogUrl = parts[3];
|
|
||||||
|
|
||||||
versionInfo.add(new VersionInfo(release, version, downloadUrl, changeLogUrl));
|
versionInfo.add(new VersionInfo(release, version, downloadUrl, changeLogUrl));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,4 +65,16 @@ public class VersionInfoLoader {
|
|||||||
return versionInfo;
|
return versionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Optional<String[]> checkLine(Scanner websiteScanner) {
|
||||||
|
String line = websiteScanner.nextLine();
|
||||||
|
if (!line.startsWith("REL") && !line.startsWith("DEV")) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
String[] parts = line.split("\\|");
|
||||||
|
if (parts.length < 4) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
return Optional.of(parts);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -24,6 +24,7 @@ import org.apache.commons.text.StringSubstitutor;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents generic HTTP Error response that has the page style in it.
|
* Represents generic HTTP Error response that has the page style in it.
|
||||||
@ -65,4 +66,19 @@ public class ErrorResponse extends PageResponse {
|
|||||||
public void setParagraph(String paragraph) {
|
public void setParagraph(String paragraph) {
|
||||||
this.paragraph = paragraph;
|
this.paragraph = paragraph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (!(o instanceof ErrorResponse)) return false;
|
||||||
|
if (!super.equals(o)) return false;
|
||||||
|
ErrorResponse that = (ErrorResponse) o;
|
||||||
|
return Objects.equals(title, that.title) &&
|
||||||
|
Objects.equals(paragraph, that.paragraph);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(super.hashCode(), title, paragraph);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ package com.djrapitops.plan.utilities.html.graphs.stack;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a value set for a Stack graph.
|
* Represents a value set for a Stack graph.
|
||||||
@ -46,4 +47,19 @@ public class StackDataSet extends ArrayList<Double> {
|
|||||||
public String getColor() {
|
public String getColor() {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (!(o instanceof StackDataSet)) return false;
|
||||||
|
if (!super.equals(o)) return false;
|
||||||
|
StackDataSet doubles = (StackDataSet) o;
|
||||||
|
return Objects.equals(name, doubles.name) &&
|
||||||
|
Objects.equals(color, doubles.color);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(super.hashCode(), name, color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user