-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
41 lines (35 loc) · 1.41 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Glot makes it easier to populate Java builder objects from Ruby.
Population Strategy:
* A populator is constructed for a given builder class
* The populator can take a hash of attributes and populate an instance of that builder using the corresponding values
* It does this using the following algorithm:
** Search for a method "with#{AttributeName}" on the builder class
** If found, inspect argument type
** If not found error
Convention:
Builders follow the following conventions:
* named according to "#{NameOfTypeBuilt}Builder"
* have a no argument constructor
* have a no argument "build" method
* have many "with#{AttributeName}" methods for accumulating state.
** in the case of a primitive type, the "with#{PrimitiveAttribute}" method takes one of:
*** String
*** Integer
*** Long
*** Float
*** Double
*** Boolean
*** BigDecimal
*** BigInteger
** in the case of a composite type, a builder is expected to exist for that type
** in the case of a collection, at least two methods are expected:
*** "with#{CollectionOfTsAttribute}(? extends Iterable<T> ts)"
*** "with#{CollectionOfTsAttribute}(T first, T... rest)"
** in the case of a tiny type, the "with#{TinyTypeAttribute}" method takes an instance of that tiny type
*** a tiny type is a type with a single argument constructor
Error Conditions:
* Convention violations
* Type conversion failures
* Attribute hash errors?
Nice To Haves:
* Validate convention conformance of builders