Skip to content

Constructors for required parameters, document thread-safety, use getters/setters #1

@wonderfly

Description

@wonderfly

From yan...@google.com on May 11, 2011 08:27:43

External references, such as a standards document, or specification? N/A Java environments (e.g. Java 6, Android 2.3, App Engine 1.4.3, 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. We might also want constructors that also take optional fields. Finally, we should consider the option to not even provide the default constructor. A big motivation for the switch is thread safety and immutability, and consistency throughout the library.

Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=1

Metadata

Metadata

Assignees

Labels

type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions