I have following class:
public class Owner {
private final Integer id;
private final OwnerType type;
public Owner(Integer iId, Enum eType) {
this.id= iId;
this.lastName = lName;
this.type = eType // how should that work?
}
}
And
public enum OwnerType {
HUMAN,INSTITUTION
}
Which I am calling via:
try {
File file = new File("resources/Owner.txt");
Scanner fileContent = new Scanner(file);
while (fileContent.hasNextLine()) {
String[] person = fileContent.nextLine().split(" ");
this.data.add(new Owner(owner[0],owner[1]));
}
} catch (FileNotFoundException err){
System.out.println(err);
}
Where Owner.txt has a format of:
ID TYPE
Like that:
1 HUMAN
2 INSTITUTION
My question is:
How can I specify the type
property of my Owner Object when I am calling the following?
new Owner(owner[0],owner[1])