Check for byte array in model inferrer [message #1806702] |
Tue, 14 May 2019 07:50 |
Nils Ehmke Messages: 1 Registered: May 2019 |
Junior Member |
|
|
Hi everyone,
I develop a Xbase-based DSL in which the developer can describe certain types with fields. At some point in the model inferrer, I want to check whether a field is of type "byte[]" - an array of primitive byte. I struggle a little bit with this check. I currently have the following:
if (member.type.isArray) {
val componentType = (member.type as JvmGenericArrayTypeReference).componentType
if (componentType.isPrimitive) {
val primitiveType = componentType.type as JvmPrimitiveType
if (primitiveType.simpleName == 'byte') {
field.annotations += jpa.lob.annotationRef
}
}
}
This works. However, both type casts and the compare with the String "byte" just seem wrong to me. Is there a better way to do this?
Thanks a lot in advance.
|
|
|
Powered by
FUDForum. Page generated in 0.03811 seconds