I have a class like follows:
class A{
// it has some getters and setters
}
There is another class called builder class which builds class A
class BuilderA{
// builds A and returns an instance.
}
Now i want to prepare a readOnly class A which make sure that Class newA will have only the getters of ClassA and not the setters.
I am doing this to make sure that if i pass this newA i am safe that nobody can use getters and make any changes to newA which can happen if i use class A directly..
Can anybody tell me how can i achieve this..?