Home » Modeling » EMF » Data Types for complex types such as Currency and Time
Data Types for complex types such as Currency and Time [message #673675] |
Tue, 24 May 2011 13:00 |
|
Hi,
I wanted to know what is the best way to represent a complex type such as Currency or Time is EMF.
These data type not only have a value but also units, that are important. For eg. currency could be "100 $" and Time could be "120 milliseconds".
Within my domain ECore model, many model entities (EClasses) need to define attributes with Currency or Time as their type. I don't want to create an EClassifier for Currency and Time and later reference them from other model entities as they cannot be persisted under one container and need to be persisted in all the model elements that use them.
Any help would be really appreciated.
Thanks,
Nidhi
[Updated on: Wed, 25 May 2011 13:39] Report message to a moderator
|
|
| |
Re: Data Types for complex types such as Currency and Time [message #687040 is a reply to message #673675] |
Tue, 24 May 2011 13:45 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Nidhi,
Comments below.
Nidhi wrote:
> Hi,
>
> I wanted to know what is the best way to represent a complex type such
> as Currency or Time is EMF.
>
> These data type not only have a value but also units, that are
> important. For eg. currency could be "100 $" and Time could be "120
> milliseconds".
In the end, if you think about it, most values represent values in some
type of unit, but the unit is implicit.
> Within my domain ECore model, many model entities (EClasses) need to
> define attributes with Currency or Time as their type. I don't want to
> create an EClassifier for Currency and Time and later reference them
> from other model entities as they cannot be persisted under one
> container and need to be persisted in all the model elements that use
> them.
Yes, these types of things should be EDataTypes. Look at XML Schema as
an example of how various units of time are represented, and then look
at how they're represented in Java.
>
> Any help would be really appreciated.
In the end, I'm not sure your question is so much an EMF one but a Java
one. I think it's best to come up with a good Java representation and
that wrap that with an EDataType...
>
> Thanks,
> Nidhi
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Data Types for complex types such as Currency and Time [message #687053 is a reply to message #687040] |
Wed, 25 May 2011 21:09 |
Eclipse User |
|
|
|
Originally posted by:
I recommend using JScience (http://jscience.org/) and as Ed suggests,
implement EDataTypes for their classes.
Hallvard
On 24.05.11 15.45, Ed Merks wrote:
> Nidhi,
>
> Comments below.
>
> Nidhi wrote:
>> Hi,
>>
>> I wanted to know what is the best way to represent a complex type such
>> as Currency or Time is EMF.
>>
>> These data type not only have a value but also units, that are
>> important. For eg. currency could be "100 $" and Time could be "120
>> milliseconds".
> In the end, if you think about it, most values represent values in some
> type of unit, but the unit is implicit.
>> Within my domain ECore model, many model entities (EClasses) need to
>> define attributes with Currency or Time as their type. I don't want to
>> create an EClassifier for Currency and Time and later reference them
>> from other model entities as they cannot be persisted under one
>> container and need to be persisted in all the model elements that use
>> them.
> Yes, these types of things should be EDataTypes. Look at XML Schema as
> an example of how various units of time are represented, and then look
> at how they're represented in Java.
>>
>> Any help would be really appreciated.
> In the end, I'm not sure your question is so much an EMF one but a Java
> one. I think it's best to come up with a good Java representation and
> that wrap that with an EDataType...
>>
>> Thanks,
>> Nidhi
|
|
|
Re: Data Types for complex types such as Currency and Time [message #687241 is a reply to message #673675] |
Tue, 24 May 2011 13:45 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Nidhi,
Comments below.
Nidhi wrote:
> Hi,
>
> I wanted to know what is the best way to represent a complex type such
> as Currency or Time is EMF.
>
> These data type not only have a value but also units, that are
> important. For eg. currency could be "100 $" and Time could be "120
> milliseconds".
In the end, if you think about it, most values represent values in some
type of unit, but the unit is implicit.
> Within my domain ECore model, many model entities (EClasses) need to
> define attributes with Currency or Time as their type. I don't want to
> create an EClassifier for Currency and Time and later reference them
> from other model entities as they cannot be persisted under one
> container and need to be persisted in all the model elements that use
> them.
Yes, these types of things should be EDataTypes. Look at XML Schema as
an example of how various units of time are represented, and then look
at how they're represented in Java.
>
> Any help would be really appreciated.
In the end, I'm not sure your question is so much an EMF one but a Java
one. I think it's best to come up with a good Java representation and
that wrap that with an EDataType...
>
> Thanks,
> Nidhi
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Data Types for complex types such as Currency and Time [message #687257 is a reply to message #687040] |
Wed, 25 May 2011 21:09 |
Eclipse User |
|
|
|
Originally posted by:
I recommend using JScience (http://jscience.org/) and as Ed suggests,
implement EDataTypes for their classes.
Hallvard
On 24.05.11 15.45, Ed Merks wrote:
> Nidhi,
>
> Comments below.
>
> Nidhi wrote:
>> Hi,
>>
>> I wanted to know what is the best way to represent a complex type such
>> as Currency or Time is EMF.
>>
>> These data type not only have a value but also units, that are
>> important. For eg. currency could be "100 $" and Time could be "120
>> milliseconds".
> In the end, if you think about it, most values represent values in some
> type of unit, but the unit is implicit.
>> Within my domain ECore model, many model entities (EClasses) need to
>> define attributes with Currency or Time as their type. I don't want to
>> create an EClassifier for Currency and Time and later reference them
>> from other model entities as they cannot be persisted under one
>> container and need to be persisted in all the model elements that use
>> them.
> Yes, these types of things should be EDataTypes. Look at XML Schema as
> an example of how various units of time are represented, and then look
> at how they're represented in Java.
>>
>> Any help would be really appreciated.
> In the end, I'm not sure your question is so much an EMF one but a Java
> one. I think it's best to come up with a good Java representation and
> that wrap that with an EDataType...
>>
>> Thanks,
>> Nidhi
|
|
|
Goto Forum:
Current Time: Thu Sep 26 11:58:06 GMT 2024
Powered by FUDForum. Page generated in 0.03686 seconds
|