blob: 1903c2cc6e0c5ee1805bc906007db3fa2412d25e [file] [log] [blame]
//////////////////////
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
//////////////////////
[[core-api-value,ValueComposite]]
= ValueComposite =
Usage of value objects is one of the most ignored and best return-on-investment the programmer can do. Values are
immutable and can be compared by value instead of memory reference. Concurrency is suddenly not an issue, since either
the value exists or it doesn't, no need for synchronization. Values are typically very easy to test and very robust to
refactoring.
Polygeneâ„¢ defines values as a primary meta type through the ValueComposite, as we think the benefits of values are great.
The ValueComposite is very light-weight compared to the EntityComposite, and its value can still be persisted as part
of an EntityComposite via a Property.
The characteristics of a ValueComposite compared to other Composite meta types are;
* It is Immutable.
* Its equals/hashCode works on both the descriptor and the values of the ValueComposite.
* Can be used as Property types.
* Can be serialized and deserialized, see <<core-api-serialization>>.