I have the method below, which passes data into an object which is also included. If I debug the program step by step, then I can see that the correct data is being passed into each field in the object. However, once I try and do a println, I'm not getting the right data back from the object
for each iteration of the loop, The data from the scrape is passed in to the object as:
[Prague, Aer, Lingus, EI645, 24, Feb, 17:15, Arrived, 17:32]
and is assigned to all the fields without a problem. when I call the print method, I then get the following, instead of one of the above rows
====================TEST=======================
com.beezer.DublinAirportArrivals.ArrivalDetails@25595f51
================END TEST=======================
What am I doing wrong here?
public HtmlParser(Properties config) throws IOException{
url = config.getProperty("url");
airline = config.getProperty("airline");
print("Fetching.........%s" , url);
}
public ArrayList<ArrivalDetails> process() throws IOException{
Document doc = Jsoup.connect(url).get();
Elements tableRow = doc.getElementsByTag("tr");
for(Element tr : tableRow){
if(tr.text().contains(airline)){
if(tr.text().contains("Arrived")){
String delims = "[ ]+";
String[] singleRowArray = tr.text().split(delims);
ArrivalDetails temp = new ArrivalDetails(singleRowArray);
capture.add(temp);
}
}
}
testPrint();
return capture;
}
public static void testPrint(){
System.out.println("====================TEST=======================");
System.out.println(capture.get(capture.size()-1));
System.out.println("================END TEST=======================");
}
Here's my other Class
public class ArrivalDetails {
public ArrivalDetails(String[] singleRowArray) {
String origin = singleRowArray[0];
String airline1 = singleRowArray[1];
String airline2 = singleRowArray[2];
String flightNo = singleRowArray[3];
String date = singleRowArray[4];
String month = singleRowArray[5];
String ArrTime = singleRowArray[6];
String status = singleRowArray[7];
}
}