CPrimitive / CBoolean.getType()

Hi,

CPrimitive.getType() is used by the constructor of CPrimitiveObject to set the RMTypeName of the CPrimitiveObject.

Looking at the CPrimitives, there seems to be some inconsistencies:

CInteger → Integer
CString → String
CReal → Double
CBoolean → DvBoolean
CDuration → DvDuration
CTime → DvTime
CDate → DvDate
CDateTime → DvDateTime

All the DV* are not actually primitive types.
if I understand this correctly, the primitive types are listed in the Support IM and are - mostly - simple types as you’d know them from your programming language of choice, e.g. Boolean, String, Integer.

Thus, my understanding is that some of the CPrimitive.getType() values are incorrect.

CInteger → Integer (unchanged)
CString → String (unchanged)
CReal → Double (unchanged, although one could argue if Real as an assumed inbuilt type isn’t better suited)
CBoolean → Boolean (changed from DvBoolean)

// not sure what to do about these. The Java impl. uses them like primitive types, so this may be ok.
CDuration → DvDuration
CTime → DvTime
CDate → DvDate
CDateTime → DvDateTime

My suggestion is to change the getType() value for CBoolean to a simple “Boolean”.
Any comments?

Cheers
Sebastian

If I remember correctly, in a DvBoolean you have the ability to allow
the true or false value from a boolean (which is not supported by a
simple boolean). Maybe that's the reasoning behind that

Regards

Isn’t that just a constraint imposed by CBoolean (“inside” the DvBoolean, of course)?
Likewise then, an integer is constrained by CInteger, which can be used to define a range or a list of valids integers.

CBoolean is the only CPrimitive that has a getType() that is different from the defaultValue which can be set by CBoolean.

The reason why we found this is when you convert this to XML using the Java framework.

**DV_BOOLEAN** omitted for clarity value omitted for clarity **DV_BOOLEAN** omitted for clarity true true

If you look at the Archetype Editor’s XML output, it would only put in BOOLEAN.
Same for DURATION (instead of DV_DURATION), DATE instead of DV_DATE, etc.

So at least it is inconsistent, but happy to argue which one is right and how much it matters.

Cheers
Sebastian