OnJava8-Examples/typeinfo/Position.java

32 lines
762 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: typeinfo/Position.java
2015-05-29 14:18:51 -07:00
// <20>2015 MindView LLC: see Copyright.txt
2015-04-20 15:36:01 -07:00
class Position {
private String title;
private Person person;
public Position(String jobTitle, Person employee) {
title = jobTitle;
person = employee;
if(person == null)
person = Person.NULL;
}
public Position(String jobTitle) {
title = jobTitle;
person = Person.NULL;
2015-05-18 23:05:20 -07:00
}
2015-04-20 15:36:01 -07:00
public String getTitle() { return title; }
public void setTitle(String newTitle) {
title = newTitle;
}
public Person getPerson() { return person; }
public void setPerson(Person newPerson) {
person = newPerson;
if(person == null)
person = Person.NULL;
}
2015-05-05 11:20:13 -07:00
@Override
2015-04-20 15:36:01 -07:00
public String toString() {
return "Position: " + title + " " + person;
}
} ///:~