mirror of
https://github.com/akaessens/NoFbEventScraper
synced 2025-06-05 23:29:13 +02:00
make fbevent properties immutable
This commit is contained in:
@ -6,19 +6,18 @@ import java.time.format.FormatStyle;
|
||||
|
||||
public class FbEvent {
|
||||
|
||||
public String url;
|
||||
public String name;
|
||||
public ZonedDateTime start_date;
|
||||
public ZonedDateTime end_date;
|
||||
public String description;
|
||||
public String location;
|
||||
public String image_url;
|
||||
public final String url;
|
||||
public final String name;
|
||||
public final ZonedDateTime start_date;
|
||||
public final ZonedDateTime end_date;
|
||||
public final String description;
|
||||
public final String location;
|
||||
public final String image_url;
|
||||
|
||||
public FbEvent() {
|
||||
|
||||
}
|
||||
|
||||
public FbEvent(String name, ZonedDateTime start_date, ZonedDateTime end_date, String description, String location, String image_url) {
|
||||
public FbEvent(String url, String name, ZonedDateTime start_date, ZonedDateTime end_date,
|
||||
String description, String location, String image_url) {
|
||||
this.url = url;
|
||||
this.name = name;
|
||||
this.start_date = start_date;
|
||||
this.end_date = end_date;
|
||||
|
@ -135,14 +135,15 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
JSONObject reader = new JSONObject(json);
|
||||
|
||||
event = new FbEvent();
|
||||
event.url = url;
|
||||
event.name = readFromJson(reader, "name");
|
||||
event.start_date = toZonedDateTime(readFromJson(reader, "startDate"));
|
||||
event.end_date = toZonedDateTime(readFromJson(reader, "endDate"));
|
||||
event.description = fixDescriptionLinks(readFromJson(reader, "description"));
|
||||
event.location = fixLocation(readFromJson(reader, "location"));
|
||||
event.image_url = readFromJson(reader, "image");
|
||||
event = new FbEvent(
|
||||
url,
|
||||
readFromJson(reader, "name"),
|
||||
toZonedDateTime(readFromJson(reader, "startDate")),
|
||||
toZonedDateTime(readFromJson(reader, "endDate")),
|
||||
fixDescriptionLinks(readFromJson(reader, "description")),
|
||||
fixLocation(readFromJson(reader, "location")),
|
||||
readFromJson(reader, "image")
|
||||
);
|
||||
|
||||
} catch (URISyntaxException | MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
|
Reference in New Issue
Block a user