Public:BWmeta service/Java mapping
From YaddaWiki
(Difference between revisions)
| Line 7: | Line 7: | ||
* has a public empty constructor. | * has a public empty constructor. | ||
* every property is protected, but has a public getter and setter. | * every property is protected, but has a public getter and setter. | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
* getters of <code>String</code>, <code>YLanguage</code> and <code>List</code> properties can never return <code>null</code>. Instead, an empty <code>String</code>, <code>YLanguage.Undetermined</code> or an empty <code>List</code> is returned, respectively. | * getters of <code>String</code>, <code>YLanguage</code> and <code>List</code> properties can never return <code>null</code>. Instead, an empty <code>String</code>, <code>YLanguage.Undetermined</code> or an empty <code>List</code> is returned, respectively. | ||
| - | |||
* for every <code>List<T></code> property: | * for every <code>List<T></code> property: | ||
** its getter returns a modifiable <code>List<T></code>; | ** its getter returns a modifiable <code>List<T></code>; | ||
| Line 19: | Line 13: | ||
** its setter accepts any <code>Collection<T></code> (and copies the contents); | ** its setter accepts any <code>Collection<T></code> (and copies the contents); | ||
** there's an adder (which returns <code>this</code>). | ** there's an adder (which returns <code>this</code>). | ||
| + | * every setter and every list adder returns <code>this</code>, which allows chained setting, e.g.: | ||
| + | new YElement() | ||
| + | .setId("bwmeta1.element.foo") | ||
| + | .addName(new YName().setText("Foo").setLanguage(YLanguage.English)) | ||
| + | .addDescription(new YDescription().setText("Lorem ipsum").setLanguage(YLanguage.Latin)); | ||
The folowing contracts are to be implemented/verified in the future: | The folowing contracts are to be implemented/verified in the future: | ||
Revision as of 10:36, 27 September 2010
| Service details | |
|---|---|
| Name | BWmeta |
| Code location (relative to SVN root) | projects/dir/bwmeta-core |
| Javadoc | |
| Contact person | Jakub Jurkiewicz |
General contracts
Unless explicitly stated in the documentation, every "Y" class has the following properties:
- has a public empty constructor.
- every property is protected, but has a public getter and setter.
- getters of
String,YLanguageandListproperties can never returnnull. Instead, an emptyString,YLanguage.Undeterminedor an emptyListis returned, respectively. - for every
List<T>property:- its getter returns a modifiable
List<T>; - its getter returns the same reference all the time;
- its setter accepts any
Collection<T>(and copies the contents); - there's an adder (which returns
this).
- its getter returns a modifiable
- every setter and every list adder returns
this, which allows chained setting, e.g.:
new YElement()
.setId("bwmeta1.element.foo")
.addName(new YName().setText("Foo").setLanguage(YLanguage.English))
.addDescription(new YDescription().setText("Lorem ipsum").setLanguage(YLanguage.Latin));
The folowing contracts are to be implemented/verified in the future:
-
hashCode()andequals()methods are based on the values of all the properties, i.e., two "Y" objects are equal iff they are of the same type and all their properties are equal.
