I'm trying to create XML report, that can be opened as xls table.
I have following output:
<Report>
<test>
<string>4.419</string>
<string>4.256</string>
</test>
</Report>
from this code:
/**
* declare arrays
*/
// ArrayList<String> test = new ArrayList<String>();
ArrayList<String> stats = new ArrayList<String>();
// ArrayList<String> count = new ArrayList<String>();
/**
*return array list with loading times
*/
public ArrayList launch() {
for (int i = 0; i < 2; i++) {
// ui.off();
// ui.on();
device.pressHome();
ui.openProgramInMenu("ON");
long TStart = System.currentTimeMillis();
ui.detectContactList();
long TStop = System.currentTimeMillis();
float res = TStop - TStart;
res /= 1000;
ui.log("[loading time]: " + res);
// ui.off();
test.add(i, "Loading time");
stats.add(i, Float.toString(res));
count.add(i, Integer.toString(i));
}
System.out.println(stats);
}
where rep.class has code:
public class ReportSettings {
public List<String> test = new ArrayList<String>();
public List<String> count = new ArrayList<String>();
public List<String> stats = new ArrayList<String>();
/**
* Test method
*/
public static void main(String[] args) {
ReportSettings rep = new ReportSettings();
rep.saveXML("report/data.xml");
// System.out.println(rep.test);
// rep = rep.loadXML("report/data.xml");
// System.out.println(rep.home);
System.out.println(rep.getXML());
}
public void createReport() {
ReportSettings rep = new ReportSettings();
rep.saveXML("report/data.xml");
}
public String getXML() {
XStream xstream = new XStream();
xstream.alias("Report", ReportSettings.class);
xstream.autodetectAnnotations(true);
return xstream.toXML(this);
}
public void saveXML(String filename) {
if (!filename.contains(".xml")) {
System.out.println("Error in saveReport syntax");
return;
}
String xml = this.getXML();
File f = new File(filename);
try {
FileOutputStream fo = new FileOutputStream(f);
fo.write(xml.getBytes());
fo.close();
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
}
public ReportSettings loadXML(String filename) {
if (!filename.endsWith(".xml")) {
System.out.println("Error in loadReport syntax!");
throw new RuntimeException("Error in loadReport syntax!");
}
File f = new File(filename);
XStream xstream = new XStream(new DomDriver());
xstream.alias("Report", ReportSettings.class);
xstream.autodetectAnnotations(true);
ReportSettings ort = (ReportSettings)xstream.fromXML(f);
return ort;
}
}
Finally I want to create table from 3 ArrayList, where {stats, count, test}*i. /n
How can I use Xstream.alias to change <strings> to <somethingAnother> in the XML file? I need to change them to stringOne and stringTwo as example.
You can use the ClassAliasMapper in Xstream to give the items in your collection a different tag when serializing to XML.
You add a block like this (for each collection: stats, count, test):
ClassAliasingMapper statsMapper = new ClassAliasingMapper(xstream.getMapper());
mapper.addClassAlias("somethingAnother", String.class);
xstream.registerLocalConverter(
InteractionSession.class,
"stats",
new CollectionConverter(mapper)
);
Related
I have a method called saveAgendaDataArrayList() which is suposed to save the data from an ArrayList in a TXT file as following.
public void saveAgendaDataArrayList(String path, ArrayList<Contact> agendaDataArrayList) {
try {
if(agendaDataArrayList!=null) {
File file = new File(path);
PrintWriter p = new PrintWriter(file);
int count = agendaDataArrayList.size();
for(int i=0; i<count; i++) {
Contact temp = new Contact();
temp = agendaDataArrayList.get(i);
p.println(temp.getIdAdress()+";"+temp.getContactType()+";"+temp.getName()+";"+temp.getBirthdayDay()+
";"+temp.getBirthdayMonth()+";"+temp.getBirthdayYear()+";"+temp.getTel1()+";"+temp.getTel2()+
";"+temp.getNeigborhood()+";"+temp.getAddress()+";"+temp.getCep()+";"+temp.getEmail()
+";"+temp.getOtherInformation()+";"+temp.getCreationDate()+";");
}
p.close();
} else {
File file = new File(path);
PrintWriter p = new PrintWriter(file);
p.print("empty agenda");
p.close();
}
} catch (IOException e) {
e.printStackTrace();
}
However, when it runs, I have some new lines coming from I don't know where. Look below.
1;1;Guilhermee;00;00;;8666666;;sem bairro;;;;;12-09-2019 04:45:47;
2;1;Gabriella;00;00;;;;Morada do Sol;;;;;12-09-2019 04:45:57;
3;1;joao;00;00;;;;sem bairro;;;;;12-09-2019 05:38:13;
4;1;lua;00;00;;;;sem bairro;;;;;12-09-2019 06:11:15;
5;1;roberto;00;00;;;;sem bairro;;;;;12-09-2019 06:12:22;
6;1;joquina;00;00;;;;Monte Verde;;;;;12-09-2019 07:38:30;
7;1;luan silva;00;00;;;;sem bairro;;;;;12-09-2019 07:40:07;
8;1;manoel;00;00;;89898989;;sem bairro;asdasd;;;;12-09-2019 07:44:44;
9;1;joana;19;01;1954;;;Cidade Jardim;;;;;12-09-2019 07:48:03;
10;1;mariana;00;00;;;;sem bairro;;;;;12-09-2019 07:57:43;
11;1;agoradeucerto;00;00;;;;Morros;;;;;12-09-2019 08:01:46;
12;1;mais uma tentativa;00;00;;;;sem bairro;;;;;12-09-2019 08:43:19;
I'd like to have an output file as above, but without the empty lines.
I tried to see if the same would happen in console with the method System.out.println(), and it happened there too.
Looking in a text file editor, the Notepad, I noticed there are some LF mixed with CR LF in the end of lines.
I've reviewed the Contact class and all seems to be right.
So, what could I do to reach that result and avoid those empty lines, and why only the last line is in the correct place?
Thank you for your time.
EDIT 1 - The input method
Here is the input method. There are 2 ways to add the data into agendaDataArrayList. The first one is through reading a txt file (1st method) and the second one, through an input interface (2nd method).
1st method
public ArrayList<Contact> getAgendaDataArrayList(String path) {
try {
FileReader reader = new FileReader(path);
Scanner scanner1 = new Scanner(reader);
scanner1.useDelimiter("\r\n|\n");
int count = 0;
while(scanner1.hasNext()) {
scanner1.next();
count++;
}
System.out.println(count);
scanner1.close();
reader.close();
ArrayList<Contact> agendaDataArrayList = new ArrayList<Contact>();
FileReader reader2 = new FileReader(path);
Scanner scanner2 = new Scanner(reader2);
scanner2.useDelimiter(";");
for(int i=0; i<count; i++) {
Contact temp = new Contact();
temp.setIdAdress(scanner2.next()); //[0] id
temp.setContactType(scanner2.next()); //[1] type
temp.setName(scanner2.next()); //[2] name
temp.setBirthdayDay(scanner2.next()); //[3] birthdayDay
temp.setBirthdayMonth(scanner2.next()); //[4] birthdayMonth
temp.setBirthdayYear(scanner2.next()); //[5] birthdayYear
temp.setTel1(scanner2.next()); //[6] tel1
temp.setTel2(scanner2.next()); //[7] tel2
temp.setNeigborhood(scanner2.next()); //[8] neighborhood
temp.setAddress(scanner2.next()); //[9] address
temp.setCep(scanner2.next()); //[10] cep
temp.setEmail(scanner2.next()); //[11] email
temp.setOtherInformation(scanner2.next()); //[12] other information
temp.setCreationDate(scanner2.next()); //[13] creation date
agendaDataArrayList.add(temp);
}
scanner2.close();
reader2.close();
return agendaDataArrayList;
} catch (IOException e) {
e.printStackTrace();
ArrayList<Contact> agendaDataArrayList = new ArrayList<Contact>();
return agendaDataArrayList;
}
}
2nd method
public void saveActionButton() {
Date creationDate = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
Contact newContact = new Contact();
newContact.setIdAdress(mainApp.getNextIdAddress());
if(typeChoiceBox.getValue()==null) {
newContact.setContactType("1");
} else {
newContact.setContactType(typeChoiceBox.getValue());
}
if(nameTextField.getText()==null) {
newContact.setName("sem nome");
} else {
newContact.setName(nameTextField.getText());
}
if(dayChoiceBox.getValue()==null) {
newContact.setBirthdayDay("00");
}else {
newContact.setBirthdayDay(dayChoiceBox.getValue());
}
if(monthChoiceBox.getValue()==null) {
newContact.setBirthdayMonth("00");
}else {
newContact.setBirthdayMonth(monthChoiceBox.getValue());
}
if(yearTextField.getText()==null) {
newContact.setBirthdayYear("0000");
}else {
newContact.setBirthdayYear(yearTextField.getText());
}
if(tel1TextField.getText()==null) {
newContact.setTel1("sem número");
}else {
newContact.setTel1(tel1TextField.getText());
}
if(tel2TextField.getText()==null) {
newContact.setTel2("sem número");
}else {
newContact.setTel2(tel2TextField.getText());
}
if(neighborhoodChoiceBox.getValue()==null) {
newContact.setNeigborhood("sem bairro");
} else {
newContact.setNeigborhood(neighborhoodChoiceBox.getValue());
}
if(addressTextField.getText()==null) {
newContact.setAddress("sem endereço");
} else {
newContact.setAddress(addressTextField.getText());
}
if(cepTextField.getText()==null) {
newContact.setCep("sem CEP");
}else {
newContact.setCep(cepTextField.getText());
}
if(emailTextField.getText()==null) {
newContact.setEmail("sem e-mail");
} else {
newContact.setEmail(emailTextField.getText());
}
if(otherInfoTextArea.getText()==null) {
newContact.setOtherInformation("sem mais informações");
}else {
newContact.setOtherInformation(otherInfoTextArea.getText());
}
newContact.setCreationDate(formatter.format(creationDate).toString());
mainApp.addContactToAgendaDataArrayList(newContact);
mainApp.refreshFullContentInMainLayout();
mainApp.saveFile();
Stage stage = (Stage) saveButton.getScene().getWindow();
stage.close();
}
}
Compare the first method output of the entries with id address 12 and the other ones that have new lines before them.
It is possible that some data are inserted on windows (therefore the CR LF whitespaces) and some on the unix system (which uses only LF). Anyway, it seems tha data itself contains new line marks, the PrinterWriter works as you would like.
A small test:
import java.util.ArrayList;
import java.io.*;
public class Main {
public static void main(String[] args) {
System.out.println("Hello");
ArrayList<Contact> list = new ArrayList<>();
list.add(new Contact());
list.add(new Contact());
list.add(new Contact());
list.add(new Contact());
list.add(new Contact());
try {
File file = new File("output.txt");
PrintWriter p = new PrintWriter(file);
int count = list.size();
for (int i = 0; i < count; i++) {
Contact temp = list.get(i);
p.println(temp.getFavColour() + ";" + temp.getSurname() + ";" + temp.getName() + ";");
}
p.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static class Contact {
public String getName() {
return "John";
}
public String getSurname() {
return "Black";
}
public String getFavColour() {
return "red";
}
}
}
i am having a trouble adding a string into an ArrayList. my goal is to create a list of an array using a for loop. however each time it is looping it seem always erase the previous data and then it replace it with the new data, so the ArrayList only have the value of 1 instead of 4. here is the full code
public class SerialDemo {
private static File f;
private static Save obj1;
private static Save obj;
private static int number = 4;
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
//getData("newFile.txt");
for(int i = 0; i < number;i++) {
obj = new Save();
obj.arrayLocationX.add(String.valueOf(10 * i));
obj.arrayLocationY.add(String.valueOf(20 * i));
obj.arrayTitle.add(String.valueOf(30 * i));
obj.arrayDescription.add(String.valueOf(40 * i));
obj.arrayNumber.add(""+i);
}
for(String x:obj.arrayLocationX) {
System.out.println(obj.arrayLocationX);
}
//setData("newFile.txt");
/*getData("newFile.txt");
for(int i = 0; i < obj.arrayLocationX.size(); i++) {
System.out.println("Value of Desc"+obj1.arrayNumber);
System.out.println("Value of locX"+obj1.arrayLocationX.get(i));
System.out.println("Value of locY"+obj1.arrayLocationY.get(i));
System.out.println("Value of Tit"+obj1.arrayTitle.get(i));
System.out.println("Value of Desc"+obj1.arrayDescription.get(i));
System.out.println(" ");
System.out.println(obj.arrayDescription.size());
}*/
}catch(Exception e) {
}
}
private static void setData(String fileName) {
// set the object or data
try {
f = new File(fileName);
FileOutputStream fps;
fps = new FileOutputStream(f);
ObjectOutputStream dos = new ObjectOutputStream(fps);
dos.writeObject(obj);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(IOException e) {
}
}
private static void getData(String fileName) {
// get the object or data
try {
f = new File(fileName);
FileInputStream fin = new FileInputStream(f);
ObjectInputStream Oin = new ObjectInputStream(fin);
obj1 = (Save) Oin.readObject();
}catch(FileNotFoundException e) {
}catch(IOException e) {
}catch(ClassNotFoundException e) {
}
}
}
class Save implements Serializable {
ArrayList<String> arrayNumber = new ArrayList<String>();
ArrayList<String> arrayLocationX = new ArrayList<String>();
ArrayList<String> arrayLocationY = new ArrayList<String>();
ArrayList<String> arrayTitle = new ArrayList<String>();
ArrayList<String> arrayDescription = new ArrayList<String>();
}
A new obj is created in every iteration hence your added string is lost. Try moving obj = new Save(); before the loop.
for(int i = 0; i < number;i++) {
obj = new Save();
obj is instantiated as a new Save every time the loop begins again. This means all your progress from the previous loop is lost and the new Save is the one that receives the inserts. You only want to create obj once, somewhere before the loop. Swapping the order of the lines should cause the program to work.
obj = new Save();
for(int i = 0; i < number;i++) {
Good day!
I have a method which returns me an array of report names
System.out.println(bc[i].getDefaultName().getValue()
i want to use array output in other class, how i need to linked method outpud in my array in other class?
Method is:
public class ReoprtSearch {
public void executeTasks() {
PropEnum props[] = new PropEnum[] { PropEnum.searchPath, PropEnum.defaultName};
BaseClass bc[] = null;
String searchPath = "//report";
//searchPath for folder - //folder, report - //report, folder and report - //folder | //report
try {
SearchPathMultipleObject spMulti = new SearchPathMultipleObject(searchPath);
bc = cmService.query(spMulti, props, new Sort[] {}, new QueryOptions());
} catch (Exception e) {
e.printStackTrace();
return;
}
if (bc != null) {
for (int i = 0; i < bc.length; i++) {
System.out.println(bc[i].getDefaultName().getValue();
}
}
}
}
array in what i want put the array looks like:
String [] folders =
my trying like:
ReoprtSearch search = new ReoprtSearch();
String [] folders = {search.executeTasks()};
Returns me an error: cannot convert from void to string
Give me an explanations to understand how i can related to method output from other class.
Thanks
The problem is that your executeTasks method doesn't actually return anything (which is why it's void), and just prints to stdout. Instead of printing, add the names to an array and then return it. Something like this:
public class ReoprtSearch {
public String[] executeTasks() {
PropEnum props[] = new PropEnum[] { PropEnum.searchPath, PropEnum.defaultName};
BaseClass bc[] = null;
String searchPath = "//report";
//searchPath for folder - //folder, report - //report, folder and report - //folder | //report
try {
SearchPathMultipleObject spMulti = new SearchPathMultipleObject(searchPath);
bc = cmService.query(spMulti, props, new Sort[] {}, new QueryOptions());
} catch (Exception e) {
e.printStackTrace();
return null;
}
if (bc != null) {
String results[] = new String[bc.length];
for (int i = 0; i < bc.length; i++) {
results[i] = bc[i].getDefaultName().getValue();
}
return results;
}
return null;
}
}
The context is as follows:
I've got objects that represent Tweets (from Twitter). Each object has an id, a date and the id of the original tweet (if there was one).
I receive a file of tweets (where each tweet is in the format of 05/04/2014 12:00:00, tweetID, originalID and is in its' own line) and I want to save them as an XML file where each field has its' own tag.
I want to then be able to read the file and return a list of Tweet objects corresponding to the Tweets from the XML file.
After writing the XML parser that does this I want to test that it works correctly. I've got no idea how to test this.
The XML Parser:
public class TweetToXMLConverter implements TweetImporterExporter {
//there is a single file used for the tweets database
static final String xmlPath = "src/main/resources/tweetsDataBase.xml";
//some "defines", as we like to call them ;)
static final String DB_HEADER = "tweetDataBase";
static final String TWEET_HEADER = "tweet";
static final String TWEET_ID_FIELD = "id";
static final String TWEET_ORIGIN_ID_FIELD = "original tweet";
static final String TWEET_DATE_FIELD = "tweet date";
static File xmlFile;
static boolean initialized = false;
#Override
public void createDB() {
try {
Element tweetDB = new Element(DB_HEADER);
Document doc = new Document(tweetDB);
doc.setRootElement(tweetDB);
XMLOutputter xmlOutput = new XMLOutputter();
// display nice nice? WTF does that chinese whacko want?
xmlOutput.setFormat(Format.getPrettyFormat());
xmlOutput.output(doc, new FileWriter(xmlPath));
xmlFile = new File(xmlPath);
initialized = true;
} catch (IOException io) {
System.out.println(io.getMessage());
}
}
#Override
public void addTweet(Tweet tweet) {
if (!initialized) {
//TODO throw an exception? should not come to pass!
return;
}
SAXBuilder builder = new SAXBuilder();
try {
Document document = (Document) builder.build(xmlFile);
Element newTweet = new Element(TWEET_HEADER);
newTweet.setAttribute(new Attribute(TWEET_ID_FIELD, tweet.getTweetID()));
newTweet.setAttribute(new Attribute(TWEET_DATE_FIELD, tweet.getDate().toString()));
if (tweet.isRetweet())
newTweet.addContent(new Element(TWEET_ORIGIN_ID_FIELD).setText(tweet.getOriginalTweet()));
document.getRootElement().addContent(newTweet);
} catch (IOException io) {
System.out.println(io.getMessage());
} catch (JDOMException jdomex) {
System.out.println(jdomex.getMessage());
}
}
//break glass in case of emergency
#Override
public void addListOfTweets(List<Tweet> list) {
for (Tweet t : list) {
addTweet(t);
}
}
#Override
public List<Tweet> getListOfTweets() {
if (!initialized) {
//TODO throw an exception? should not come to pass!
return null;
}
try {
SAXBuilder builder = new SAXBuilder();
Document document;
document = (Document) builder.build(xmlFile);
List<Tweet> $ = new ArrayList<Tweet>();
for (Object o : document.getRootElement().getChildren(TWEET_HEADER)) {
Element rawTweet = (Element) o;
String id = rawTweet.getAttributeValue(TWEET_ID_FIELD);
String original = rawTweet.getChildText(TWEET_ORIGIN_ID_FIELD);
Date date = new Date(rawTweet.getAttributeValue(TWEET_DATE_FIELD));
$.add(new Tweet(id, original, date));
}
return $;
} catch (JDOMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
Some usage:
private TweetImporterExporter converter;
List<Tweet> tweetList = converter.getListOfTweets();
for (String tweetString : lines)
converter.addTweet(new Tweet(tweetString));
How can I make sure the the XML file I read (that contains tweets) corresponds to the file I receive (in the form stated above)?
How can I make sure the tweets I add to the file correspond to the ones I tried to add?
Assuming that you have the following model:
public class Tweet {
private Long id;
private Date date;
private Long originalTweetid;
//getters and seters
}
The process would be the following:
create an isntance of TweetToXMLConverter
create a list of Tweet instances that you expect to receive after parsing the file
feed the converter the list you generated
compare the list received by parsing the list and the list you initiated at the start of the test
public class MainTest {
private TweetToXMLConverter converter;
private List<Tweet> tweets;
#Before
public void setup() {
Tweet tweet = new Tweet(1, "05/04/2014 12:00:00", 2);
Tweet tweet2 = new Tweet(2, "06/04/2014 12:00:00", 1);
Tweet tweet3 = new Tweet(3, "07/04/2014 12:00:00", 2);
tweets.add(tweet);
tweets.add(tweet2);
tweets.add(tweet3);
converter = new TweetToXMLConverter();
converter.addListOfTweets(tweets);
}
#Test
public void testParse() {
List<Tweet> parsedTweets = converter.getListOfTweets();
Assert.assertEquals(parsedTweets.size(), tweets.size());
for (int i=0; i<parsedTweets.size(); i++) {
//assuming that both lists are sorted
Assert.assertEquals(parsedTweets.get(i), tweets.get(i));
};
}
}
I am using JUnit for the actual testing.
I am writing a file that can parse rdf and owl files. I am using SAX and Java.
My problem is on the line activeObject.add(file);
I get the error "Syntax error on tokens, Misplaced construct(s)" - I don't know what this means. And it doesn't seem to make sense, any help would be much appreciated.
PS: I might be completely wrong about what is causing the error, it might have nothing to do with an inner class.
public static void main(String args[]) throws URISyntaxException, MalformedURLException, IOException {
// String file =
// "http://www.srdc.metu.edu.tr/ubl/contextOntology/cpc.owl";
// final String file = "http://onto.eva.mpg.de/obo/image.owl";
// final String file =
// "http://www.informatik.uni-ulm.de/ki/Liebig/owl/SUMO-LiteTB.rdf";
// final String file =
// "http://www.csd.abdn.ac.uk/~apreece/research/TowardsAnIntelligentWeb/PUB_findallbyKen_result.rdf";
// final String file =
// "http://www.srdc.metu.edu.tr/ubl/contextOntology/naics.owl";
final String file = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
URI uri = new URI(file);
InputStream is = uri.toURL().openStream();
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
DefaultHandler handler = new DefaultHandler() {
ArrayList<String> activeProperty = new ArrayList<String>();
ArrayList<Triple> triplesList = new ArrayList<Triple>();
ArrayList<String> activeObject = new ArrayList<String>();
boolean name = false;
activeObject.add(file);
public void startElement(String uri, String localName,String qName, Attributes attributes) throws SAXException {
activeProperty.add(qName);
int attrLength = attributes.getLength();
for (int i = 0; i < attrLength; i++) {
String attrName = attributes.getQName(i).toLowerCase();
String attrValue = attributes.getValue(i).toLowerCase();
if (attrName.equals("rdf:about") || attrName.equals("rdf:resource") || attrName.equals("rdf:id")) {
activeObject.add(attrValue);
System.out.println(activeObject);
}
else{
String subject = activeObject.get(activeObject.size()-1);
String predicate = attrName;
String object = attrValue;
Triple newTriple = new Triple(subject, predicate, object);
}
}
}
public void characters(char[] ch, int start, int length) throws SAXException {
// tempVal = new String(ch, start, length);
}
public void endElement(String uri, String localName, String rawName) {
String subject = activeObject.get(activeObject.size()-2);
String predicate = activeProperty.get(activeProperty.size()-1);
String object = activeObject.get(activeObject.size()-1);
Triple newTriple = new Triple(subject,predicate, object);
if (rawName.equals(activeProperty.get(activeProperty.size() - 1))) {
activeProperty.remove(activeProperty.size() - 1);
}
else{
System.out.println("Something is seriosuly wrong ...sdf.sdf.we8ryw98fsydh");
}
// System.out.println(activeProperty);
}
// if (qName.equalsIgnoreCase("NAME")) {
// name = true;
// }
// public void characters(char ch[], int start, int length)
// throws SAXException {
// if (name) {
// System.out.println("Name: "
// + new String(ch, start, length));
// name = false;
// }
// }
};
saxParser.parse(is, handler);
} catch (Exception e) {
e.printStackTrace();
}
}
You're trying to write normal statements within an anonymous class, as if you'd tried this:
class Foo extends DefaultHandler {
ArrayList<String> activeProperty = new ArrayList<String>();
ArrayList<Triple> triplesList = new ArrayList<Triple>();
ArrayList<String> activeObject = new ArrayList<String>();
boolean name = false;
activeObject.add(file);
}
You can't do that. If you want this to be performed on construction, you can put it in an initializer block, like this:
ArrayList<String> activeProperty = new ArrayList<String>();
ArrayList<Triple> triplesList = new ArrayList<Triple>();
ArrayList<String> activeObject = new ArrayList<String>();
boolean name = false;
{
activeObject.add(file);
}
Or you could populate the list in some other way, perhaps - for instance with Guava you could write:
ArrayList<String> activeObject = Lists.newArrayList(file);