Public:BWmeta service/Java mapping
From YaddaWiki
(→Rich text support) |
|||
Line 45: | Line 45: | ||
Starting with BWmeta 1.2.1, support for rich text is planned for certain fields. | Starting with BWmeta 1.2.1, support for rich text is planned for certain fields. | ||
+ | By rich text we mean a mixed content of text and tags from namespaces other than <code>bwmeta</code>. | ||
For example, the following should be a valid fragment of BWmeta 1.2.1: | For example, the following should be a valid fragment of BWmeta 1.2.1: | ||
<'''bwmeta:description''' lang="eng" type="abstract"> | <'''bwmeta:description''' lang="eng" type="abstract"> | ||
Line 50: | Line 51: | ||
</'''bwmeta:description'''> | </'''bwmeta:description'''> | ||
- | ... | + | <!-- name, description, tag, attribute --> |
+ | |||
+ | This calls for a change in the "Y" model. (...) To be continued. |
Revision as of 15:05, 5 October 2010
Service details | |
---|---|
Name | BWmeta |
Code location (relative to SVN root) | projects/dir/bwmeta-core |
Javadoc | |
Contact person | Jakub Jurkiewicz |
History
Three different mappings of BWmeta to Java have been written in the project's lifetime. The following table summarizes the mappings.
Model Name | Works with BWmeta versions | Usage areas | Comments |
---|---|---|---|
Repo model | 1.0.0 ÷ 1.0.5 | Processes, YaddaWeb | Hibernate-oriented |
DeskLight model | 1.0.0 ÷ 1.0.5 | DeskLight | |
"Y" model | 1.2.0 ÷ 1.2.1 | Pack Management |
Current efforts are focused on replacing the older models (Repo and DeskLight) with the latest one ("Y"). The remainder of this page and all the other pages on BWmeta usage in YADDA assume usage of the "Y" model.
General contracts
Unless explicitly stated in the documentation, every "Y" class has the following properties:
- has a public default constructor.
- every property is protected, but has a public getter and setter.
- getters of
String
,YLanguage
andList
properties can never returnnull
. Instead, an emptyString
,YLanguage.Undetermined
or an emptyList
is 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.
Rich text support
Starting with BWmeta 1.2.1, support for rich text is planned for certain fields.
By rich text we mean a mixed content of text and tags from namespaces other than bwmeta
.
For example, the following should be a valid fragment of BWmeta 1.2.1:
<bwmeta:description lang="eng" type="abstract"> <xhtml:em>Lorem ipsum</xhtml:em> dolor sit amet <mathml:math>[...]</mathml:math> </bwmeta:description>
This calls for a change in the "Y" model. (...) To be continued.