From e588a7ded6fae3b033e1a59a4c24d1e1a6799747 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 21 Dec 2022 02:11:47 +0300 Subject: sape: adopt records --- src/main/java/com/juick/www/ad/models/Page.java | 19 ++-------------- src/main/java/com/juick/www/ad/models/Site.java | 30 ++----------------------- 2 files changed, 4 insertions(+), 45 deletions(-) (limited to 'src/main/java/com/juick/www/ad/models') diff --git a/src/main/java/com/juick/www/ad/models/Page.java b/src/main/java/com/juick/www/ad/models/Page.java index d5bb8ae3..6beb49d3 100644 --- a/src/main/java/com/juick/www/ad/models/Page.java +++ b/src/main/java/com/juick/www/ad/models/Page.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2022, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -19,19 +19,4 @@ package com.juick.www.ad.models; import java.util.List; -public class Page { - private final String uri; - private final List links; - - public Page(String uri, List links) { - this.uri = uri; - this.links = links; - } - - public String getUri() { - return uri; - } - public List getLinks() { - return links; - } -} +public record Page(String uri, List links) { } diff --git a/src/main/java/com/juick/www/ad/models/Site.java b/src/main/java/com/juick/www/ad/models/Site.java index fbe1c033..d2cb773f 100644 --- a/src/main/java/com/juick/www/ad/models/Site.java +++ b/src/main/java/com/juick/www/ad/models/Site.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2022, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -32,33 +32,7 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; -public class Site { - private final String siteUrl; - private final String delimiter; - private final List pages; - private final String code; - - public Site(String siteUrl, String code, String delimiter, List pages) { - this.siteUrl = siteUrl; - this.code = code; - this.delimiter = delimiter; - this.pages = pages; - } - - public String getSiteUrl() { - return siteUrl; - } - public String getDelimiter() { - return delimiter; - } - public List getPages() { - return pages; - } - - public String getCode() { - return code; - } - +public record Site(String siteUrl, String code, String delimiter, List pages) { public static Site fromXMLData(String data) throws ParserConfigurationException, IOException, SAXException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); -- cgit v1.2.3