hi,
I am creating a java API for an addressbook Is it a good practice to use Enums in my API ?
I am using it as follows:
public enum AddressType {
WORK,HOME
}
public class AddressBook implements Function{
Map<String, Details> byName = new TreeMap<String,Details>();
public void addNewContact(String name, String address, AddressType
addressType) {
byName.put(name, new Details(name,new Address(address,addressType)));
// addressType is my enum AddressType
}
Please advise if there is a better way to do this?
Also could you guide on how I could determine which methods I should declare as protected and private? I want this API to be accessible for public so my understanding was that all the methods, classes, enums I create should be public. But would that not be overlooking encapsulation property of Java??
Please help.
Thank you }