Skip to content

Commit ffdd39a

Browse files
committed
Init.
0 parents  commit ffdd39a

20 files changed

+1247
-0
lines changed

AUTHORS

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Below is a list of people and organizations that have contributed
2+
# to the project. Names should be added to the list like so:
3+
#
4+
# Name/Organization <email address>
5+
6+
David Morgan/Google Inc. <davidmorgan@google.com>

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
## 0.0.3
4+
5+
- Allow static fields in value class.
6+
- Allow custom setters in builder.
7+
8+
## 0.0.2
9+
10+
- Fix error message for missing builder class.
11+
- Allow non-abstract getters in value class.
12+
13+
## 0.0.1
14+
15+
- Generator, tests and example.

CONTRIBUTING.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Want to contribute? Great! First, read this page (including the small print at
2+
the end).
3+
4+
### Before you contribute
5+
Before we can use your code, you must sign the
6+
[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual)
7+
(CLA), which you can do online. The CLA is necessary mainly because you own the
8+
copyright to your changes, even after your contribution becomes part of our
9+
codebase, so we need your permission to use and distribute your code. We also
10+
need to be sure of various other things—for instance that you'll tell us if you
11+
know that your code infringes on other people's patents. You don't have to sign
12+
the CLA until after you've submitted your code for review and a member has
13+
approved it, but you must do it before we can put your code into our codebase.
14+
15+
Before you start working on a larger contribution, you should get in touch with
16+
us first through the issue tracker with your idea so that we can help out and
17+
possibly guide you. Coordinating up front makes it much easier to avoid
18+
frustration later on.
19+
20+
### Code reviews
21+
All submissions, including submissions by project members, require review. We
22+
use Github pull requests for this purpose.
23+
24+
### File headers
25+
All files in the project must start with the following header.
26+
27+
// Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
28+
// All rights reserved. Use of this source code is governed by a BSD-style
29+
// license that can be found in the LICENSE file.
30+
31+
### The small print
32+
Contributions made by corporations are covered by a different agreement than the
33+
one above, the
34+
[Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate).

LICENSE

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright 2015, Google Inc. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following disclaimer
11+
in the documentation and/or other materials provided with the
12+
distribution.
13+
14+
* Neither the name of Google Inc. nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Built Values for Dart
2+
3+
Built values are value types for Dart.
4+
5+
They have generated `equals`, `hashCode`, `toString` and builder class.
6+
7+
This provides an easy way to write deeply immutable classes for Dart that
8+
behave in a consistent, predicatable way.
9+
10+
See
11+
[this example](https://github.com/google/built_value.dart/tree/master/example)
12+
for a full project with a `build.dart` and some example value types.
13+
14+
## Features and bugs
15+
16+
Please file feature requests and bugs at the [issue tracker][tracker].
17+
18+
[tracker]: https://github.com/google/built_value.dart/issues

built_value/LICENSE

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright 2015, Google Inc. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following disclaimer
11+
in the documentation and/or other materials provided with the
12+
distribution.
13+
14+
* Neither the name of Google Inc. nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

built_value/lib/built_value.dart

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
2+
// All rights reserved. Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
library built_value;
6+
7+
export 'package:quiver/core.dart' show hashObjects;
8+
9+
/// Implement this for a Built Value.
10+
///
11+
/// Then use built_value_generator.dart code generation functionality to
12+
/// provide the rest of the implementation.
13+
///
14+
/// See <https://github.com/google/built_value.dart/tree/master/example>
15+
abstract class Built<V extends Built<V, B>, B extends Builder<V, B>> {
16+
/// Rebuilds the instance.
17+
///
18+
/// The result is the same as this instance but with [updates] applied.
19+
/// [updates] is a function that takes a builder [B].
20+
///
21+
/// The implementation of this method will be generated for you by the
22+
/// built_value generator.
23+
V rebuild(updates(B builder));
24+
25+
/// Converts the instance to a builder [B].
26+
///
27+
/// The implementation of this method will be generated for you by the
28+
/// built_value generator.
29+
B toBuilder();
30+
}
31+
32+
/// Every Built Value must have a [Builder] class.
33+
///
34+
/// Use it to set defaults, if needed, and to do validation.
35+
///
36+
/// See <https://github.com/google/built_value.dart/tree/master/example>
37+
abstract class Builder<V extends Built<V, B>, B extends Builder<V, B>> {
38+
/// Replaces the value in the builder with a new one.
39+
///
40+
/// The implementation of this method will be generated for you by the
41+
/// built_value generator.
42+
void replace(V value);
43+
44+
/// Applies updates.
45+
///
46+
/// [updates] is a function that takes a builder [B].
47+
void update(updates(B builder));
48+
49+
/// Builds.
50+
///
51+
/// The implementation of this method will be generated for you by the
52+
/// built_value generator.
53+
///
54+
/// Override this method to add validation at build time.
55+
V build();
56+
}
57+
58+
// Nullable annotation for Built Value fields.
59+
//
60+
// Fields marked with this annotation are allowed to be null.
61+
const String nullable = 'nullable';

built_value/pubspec.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: built_value
2+
version: 0.0.3
3+
description: >
4+
Value types with builders. This library is the runtime dependency.
5+
authors:
6+
- David Morgan <davidmorgan@google.com>
7+
homepage: https://github.com/google/built_value.dart
8+
9+
environment:
10+
sdk: '>=1.8.0 <2.0.0'
11+
12+
dependencies:
13+
quiver: '>=0.21.0 <0.22.0'

built_value_generator/LICENSE

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright 2015, Google Inc. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following disclaimer
11+
in the documentation and/or other materials provided with the
12+
distribution.
13+
14+
* Neither the name of Google Inc. nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)