Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. SomeClass instance = // ....
  2.  
  3.  
  4. public SomeClass getInstance() {
  5. return new SomeClass(instance);
  6. }
  7.  
  8. // Option A with a "limiting public interface"
  9. public interface Awesome {
  10. public String getText();
  11. }
  12.  
  13. class MyAwesome implements Awesome {
  14. public String getText() {
  15. // ..
  16. }
  17. // Option B is to make setText non-public
  18. public void setText() {
  19. // ..
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement