You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Rall <dl...@finemaltcoding.com> on 2001/11/28 11:02:28 UTC

Re: svn commit: rev 544 - trunk/subversion/bindings/java/jni/org/tigris/subversion/lib

I'm trying to understand the use of the public member variables
instead of accessor methods.  Are they to make the Java data
structures look more like the C structures?  If so, is this a good
idea?

XelaRellum@tigris.org writes:

> Author: XelaRellum
> Date: 2001-11-28 08:42 GMT
> New Revision: 544
>
> Modified:
>    trunk/subversion/bindings/java/jni/org/tigris/subversion/lib/Entry.java
> Log:
> now Entry.java reflects svn_wc_entry_t
>
> Modified: trunk/subversion/bindings/java/jni/org/tigris/subversion/lib/Entry.java
> ==============================================================================
> --- OLD/trunk/subversion/bindings/java/jni/org/tigris/subversion/lib/Entry.java	Wed Nov 28 02:42:43 2001
> +++ NEW/trunk/subversion/bindings/java/jni/org/tigris/subversion/lib/Entry.java	Wed Nov 28 02:42:43 2001
> @@ -16,6 +16,9 @@
>   * ====================================================================
>   **/
>  
> +import java.util.Date;
> +import java.util.Hashtable;
> +
>  public class Entry {
>      public final static int SCHEDULE_NORMAL=0;
>      public final static int SCHEDULE_ADD=1;
> @@ -33,20 +36,27 @@
>      public final static int NODEKIND_DIR = 2;
>      public final static int NODEKIND_UNKNOWN = 3;
>  
> +    public final long revision;
>      public final String url;
> -    public final int revision;
>      public final int nodeKind;
>      public final int schedule;
>      public final int existence;
> +    public final Date text_time;
> +    public final Date prop_time;
> +    public final Hashtable attributes;
>  
> -    public Entry(String url, int revision, 
> -		 int nodeKind, int schedule, int existence)
> +    public Entry( long _revision, String _url, int _nodeKind, 
> +                  int _schedule, int _existence, Date _text_time, 
> +                  Date _prop_time, Hashtable _attributes )
>  	{
> -	    this.url = url;
> -	    this.revision = revision;
> -	    this.nodeKind = nodeKind;
> -	    this.schedule = schedule;
> -	    this.existence = existence;
> +	    url = _url;
> +	    revision = _revision;
> +	    nodeKind = _nodeKind;
> +	    schedule = _schedule;
> +	    existence = _existence;
> +            text_time = _text_time;
> +            prop_time = _prop_time;
> +            attributes = _attributes;
>  	}
>  }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 544 - trunk/subversion/bindings/java/jni/org/tigris/subversion/lib

Posted by Yoshiki Hayashi <yo...@xemacs.org>.
"B. W. Fitzpatrick" <fi...@red-bean.com> writes:

> > The accessors would be needless overhead. These are more like structures,
> > rather than objects that would be extended.
> > 
> > IMO, keep 'em as attributes.
> 
> I'm -1 on this. Structures or not, consistency is king, and reaching
> into another object and touching it's instance variables is not
> consistent with how you should be using Java in the first place, IMO.
> 
> I vote +1 for accessors.

If it interests anybody, Ruby does not allow access to
instance variables.  The only way is to use accessors.

-- 
Yoshiki Hayashi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 544 - trunk/subversion/bindings/java/jni/org/tigris/subversion/lib

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Nov 28, 2001 at 10:28:22AM -0800, Daniel Rall wrote:
> Alexander Mueller <al...@littleblue.de> writes:
> 
> > there are several ways to implement data access with java.  Hm. But
> > maybe you are right. I implemented the class the way I did to
> > improve performance. The variables do have the "final" statement, so
> > they cant be changed after creation of an instance.
> 
> Hi Alex.  I noticed the final keyword, but think accessor methods are
> really the way to go, as they are more Java-esque.  Developers who
> work with Java regularly will be more familiar with an API which uses
> accessors, and also more likely to extend and integrate such an API
> (and the initial net effect will supply equivalent data access
> equivalent to the public final member variables).

The accessors would be needless overhead. These are more like structures,
rather than objects that would be extended.

IMO, keep 'em as attributes.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 544 - trunk/subversion/bindings/java/jni/org/tigris/subversion/lib

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Alexander Mueller <al...@littleblue.de> writes:

> there are several ways to implement data access with java.  Hm. But
> maybe you are right. I implemented the class the way I did to
> improve performance. The variables do have the "final" statement, so
> they cant be changed after creation of an instance.

Hi Alex.  I noticed the final keyword, but think accessor methods are
really the way to go, as they are more Java-esque.  Developers who
work with Java regularly will be more familiar with an API which uses
accessors, and also more likely to extend and integrate such an API
(and the initial net effect will supply equivalent data access
equivalent to the public final member variables).

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 544 - trunk/subversion/bindings/java/jni/org/tigris/subversion/lib

Posted by Alexander Mueller <al...@littleblue.de>.
Hi Daniel,

there are several ways to implement data access with java.
Hm. But maybe you are right. I implemented the class the
way I did to improve performance. The variables do have the "final" statement,
so they cant be changed after creation of an instance.

Sincerely
Alex



Daniel Rall schrieb:

> I'm trying to understand the use of the public member variables
> instead of accessor methods.  Are they to make the Java data
> structures look more like the C structures?  If so, is this a good
> idea?
>
> XelaRellum@tigris.org writes:
>
> > Author: XelaRellum
> > Date: 2001-11-28 08:42 GMT
> > New Revision: 544
> >
> > Modified:
> >    trunk/subversion/bindings/java/jni/org/tigris/subversion/lib/Entry.java
> > Log:
> > now Entry.java reflects svn_wc_entry_t
> >
> > Modified: trunk/subversion/bindings/java/jni/org/tigris/subversion/lib/Entry.java
> > ==============================================================================
> > --- OLD/trunk/subversion/bindings/java/jni/org/tigris/subversion/lib/Entry.java       Wed Nov 28 02:42:43 2001
> > +++ NEW/trunk/subversion/bindings/java/jni/org/tigris/subversion/lib/Entry.java       Wed Nov 28 02:42:43 2001
> > @@ -16,6 +16,9 @@
> >   * ====================================================================
> >   **/
> >
> > +import java.util.Date;
> > +import java.util.Hashtable;
> > +
> >  public class Entry {
> >      public final static int SCHEDULE_NORMAL=0;
> >      public final static int SCHEDULE_ADD=1;
> > @@ -33,20 +36,27 @@
> >      public final static int NODEKIND_DIR = 2;
> >      public final static int NODEKIND_UNKNOWN = 3;
> >
> > +    public final long revision;
> >      public final String url;
> > -    public final int revision;
> >      public final int nodeKind;
> >      public final int schedule;
> >      public final int existence;
> > +    public final Date text_time;
> > +    public final Date prop_time;
> > +    public final Hashtable attributes;
> >
> > -    public Entry(String url, int revision,
> > -              int nodeKind, int schedule, int existence)
> > +    public Entry( long _revision, String _url, int _nodeKind,
> > +                  int _schedule, int _existence, Date _text_time,
> > +                  Date _prop_time, Hashtable _attributes )
> >       {
> > -         this.url = url;
> > -         this.revision = revision;
> > -         this.nodeKind = nodeKind;
> > -         this.schedule = schedule;
> > -         this.existence = existence;
> > +         url = _url;
> > +         revision = _revision;
> > +         nodeKind = _nodeKind;
> > +         schedule = _schedule;
> > +         existence = _existence;
> > +            text_time = _text_time;
> > +            prop_time = _prop_time;
> > +            attributes = _attributes;
> >       }
> >  }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org