I have implemented a few Java applications now, only desktop applications so far. I prefer to use immutable objects for passing the data around in the application instead of
From Java 7 you can have immutable beans, the best of both worlds. Use the annotation @ConstructorProperties on your constructor.
public class Person {
private final String name;
private final Place birthPlace;
@ConstructorProperties({"name", "birthPlace"})
public Person(String name, Place birthPlace) {
this.name = name;
this.birthPlace = birthPlace;
}
public String getName() {
return name;
}
public Place getBirthPlace() {
return birthPlace;
}
}