SmartDroidDeveloper / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Constructors that take required parameters for compile-time checking #145

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
External references, such as a standards document, or specification?

N/A

Java environments (e.g. Java 6, Android 2.3, App Engine 1.4.2, or All)?

All.

Please describe the feature requested.

This feature cuts across all areas of the library.  Currently most classes have 
only default parameters.  Any required parameters must be set before calling 
any methods, at which point if any of the required parameters are null we throw 
a NullPointerException.

Instead, we could provide a constructor that has parameters for the required 
fields.  This introduces compile-time checking of those required fields.

How do you define "required" in the context of required fields?  Use the 
strictest criteria: only if the methods of the class would have thrown a 
NullPointerException if that field is set.  If there is a reasonable default 
value or reasonable fall-back behavior to handle null, or if there are cases 
where the field may be null, it doesn't count as a "required" field.

Original issue reported on code.google.com by yan...@google.com on 11 Mar 2011 at 12:32

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 2 May 2011 at 12:45

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 2 May 2011 at 8:17

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 27 Jun 2011 at 7:30

GoogleCodeExporter commented 9 years ago
Issue 254 has been merged into this issue.

Original comment by yan...@google.com on 1 Aug 2011 at 9:23

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 28 Oct 2011 at 6:20

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 7 Mar 2012 at 3:52

GoogleCodeExporter commented 9 years ago
I'm going to limit this to just the classes needed by the generated libraries, 
which is the primary way we expect users to use our library.  This are the 
parts that need to be cleaned up for an out-of-beta GA launch.

http://codereview.appspot.com/5780043/

Original comment by yan...@google.com on 7 Mar 2012 at 7:43

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 21 Mar 2012 at 1:22