Version 10 (modified by orliin, 17 years ago) (diff) |
---|
Analysis
Overview
Property Utilities are additions to the Properties Library that provide extra functionality.
Task requirements
Add utilites that:
- Assign values to a property (except Auto Properties)
- Clone objects with properties
- Other - discuss with the team if something else is needed at this iteration
Task result
The task result should be source code (with unit tests included).
Implementation idea
Cloning should keep only those properties that are needed.
Related
How to demo
Present the utilities to the team and run unit tests to demonstrate them.
Design
- Assign
The assign() method should take care about property types and annotations to decide what to do when trying to copy data. Here are all the cases:
property types | relation/annotation | value class | value action | comment |
ValueProperty | @own | immutable | error | |
pro-obj | pro.clone | |||
else | error | |||
@shared | all | copy ref | ||
none | immutable | copy ref | This includes FinalProperty obects | |
else | error | |||
ParentProperty | all | set null | Better decide whether to keep the same parent in each case. | |
FinalProperty | --> | --> | --> | Same as ValueProperty. Should the assign operation be possible? Probably not because it should be immutable |
ResourceProperty | --> | --> | none | do nothing |
AutoProperty | --> | --> | none | do nothing |
ValueListProperty | --> | --> | --> | Create a new list and apply the rules for ValueProperty to the elements of the list as if they are single values |
AutoListProperty | --> | --> | none | do nothing |
Implementation should just add these cases to the assign() method in the ProUtil class.
- Cloning
The clone() method should make a new ProObject instance which is a copy of the original object. The properties in the new instance are assigned their values via the assign() method.
- Tests
org.sophie2.core.prolib.util.ProUtilTest.java
Implementation
(Implementation results should be described and linked here (from the wiki or the repository)
Testing
Comments
Log