Addressing issues at http://wiki.apidesign.org/index.php/Allow_Access_Only_From_Friend_Code
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 10:03:27 +0200
changeset 1908b87a7d88b31
parent 189 3ca9cbfda1a5
child 191 c8a7c6621b5f
Addressing issues at http://wiki.apidesign.org/index.php/Allow_Access_Only_From_Friend_Code
samples/friendpackage/src/apipkg/AccessorImpl.java
samples/friendpackage/src/apipkg/Item.java
     1.1 --- a/samples/friendpackage/src/apipkg/AccessorImpl.java	Sat Jun 14 10:03:12 2008 +0200
     1.2 +++ b/samples/friendpackage/src/apipkg/AccessorImpl.java	Sat Jun 14 10:03:27 2008 +0200
     1.3 @@ -1,16 +1,3 @@
     1.4 -/*
     1.5 - *                 Sun Public License Notice
     1.6 - * 
     1.7 - * The contents of this file are subject to the Sun Public License
     1.8 - * Version 1.0 (the "License"). You may not use this file except in
     1.9 - * compliance with the License. A copy of the License is available at
    1.10 - * http://www.sun.com/
    1.11 - * 
    1.12 - * The Original Code is NetBeans. The Initial Developer of the Original
    1.13 - * Code is Jaroslav Tulach. Portions Copyright 2007 Jaroslav Tulach. 
    1.14 - * All Rights Reserved.
    1.15 - */
    1.16 -
    1.17  package apipkg;
    1.18  
    1.19  import implpkg.Accessor;
     2.1 --- a/samples/friendpackage/src/apipkg/Item.java	Sat Jun 14 10:03:12 2008 +0200
     2.2 +++ b/samples/friendpackage/src/apipkg/Item.java	Sat Jun 14 10:03:27 2008 +0200
     2.3 @@ -19,15 +19,14 @@
     2.4      }
     2.5      // END: design.less.friend.Item.static
     2.6      
     2.7 -    /** Contructor for friends */
     2.8 +    /** Only friends can create instances. */
     2.9      Item() {
    2.10      }
    2.11      
    2.12 -    /** Anyone can value of the item. At least if it 
    2.13 -     * can get a reference to it.
    2.14 +    /** Anyone can change value of the item. 
    2.15       */
    2.16 -    public void setValue(int x) {
    2.17 -        value = x;
    2.18 +    public void setValue(int newValue) {
    2.19 +        value = newValue;
    2.20          ChangeListener l = listener;
    2.21          if (l != null) {
    2.22              l.stateChanged(new ChangeEvent(this));
    2.23 @@ -40,7 +39,7 @@
    2.24          return value;
    2.25      }
    2.26      
    2.27 -    /** Only the impl package can listen.
    2.28 +    /** Only friends can listen to changes.
    2.29       */
    2.30      void addChangeListener(ChangeListener l) {
    2.31          assert listener == null;