using static inner classes good or bad design ?
513500Nov 8 2007 — edited Nov 9 2007Using lots of static inner classes is it a good design or not ? I am using inner classes to retrieve initialization variables
example
public class Person {
private String firstname;
private String lastname;
public Person(String firstname, String lastname){
this.firstname=firstname;
this.lastname=lastname;
}
public static interface IPerson {
public String getFirstName();
public String getLastName();
}
public static class NewPerson implements IPerson {
public String getFirstName() {
// TODO Auto-generated method stub
return "New firstname";
}
public String getLastName() {
// TODO Auto-generated method stub
return "New lastname";
}
}
}
package com.reisys.service.review.service.event.addon.action;
public class PersonCreator extends Person {
public PersonCreator(IPerson aPerson ) {
super(aPerson.getFirstName(),aPerson.getLastName());
}
public PersonCreator() {
this(new NewPerson());
}
}
In this example PersonCreator is initialized using static inner class . I am confused with the approach the approach mentioned above is it a good design?