Issue Details (XML | Word | Printable)

Key: CSC-617
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Oliver Ringel
Reporter: Jörg Reichert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Fornax Cartridge Sculptor

Cannot use Map inside DataTransferObject

Created: 09/Feb/11 01:52 PM   Updated: 22/Jan/12 03:17 PM
Component/s: None
Affects Version/s: 2.1.0
Fix Version/s: 2.2.0

Time Tracking:
Not Specified


 Description  « Hide
DataTransferObject ExampleDTO {
  Map<String, @AnotherDTO> keyToValue;
}

leads to error markers in editor as well as generation error: mismatched input 'Map' expecting '}'

I have seen https://fornax.itemis.de/jira/browse/CSC-250 but a DTO is not stored in DB, so there is no reason to not support Maps inside DataTransferObjects.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Patrik Nordwall added a comment - 11/Feb/11 11:30 AM
Good suggestion. Might be tricky with JAXB annotations though. Might work but must be investigated. Found this: http://jaxb.java.net/guide/Mapping_your_favorite_class.html

Meanwhile, you might be able to do something by defining your own type in sculptor-generator.propertes
javaType.MyMap=java.util.Map<String, Integer>

which then can be used in model.btdesign
DataTransferObject MyDto {
String foo
MyMap map
}

Jörg Reichert added a comment - 11/Feb/11 11:38 AM
I define gap in the DTO definition to be able to implement the Map operation manually but using the javaType map definition in the generator.properties is a great alternative.