public interface DMNType extends Cloneable
ItemDefinition
.namespace
; when a DMN type is a representation of an ItemDefinition
defined in a DMN model, the namespace correspond to the model's namespace as per DMNModel.getNamespace()
.
When the namespace is a FEEL reserved namespace such as https://www.omg.org/spec/DMN/20191111/FEEL/
then the DMN type stands for an equivalent representation of a built-in FEEL type.org.kie.dmn.feel.lang.Type
(s) find an equivalent representation as a DMN type when the DMNModel
is compiled.
This is by design, since the DMN layer of the Drools DMN open source engine is based on top of the FEEL layer.name
; this usually corresponds to the ItemDefinition
's name (see: NamedElement.getName()
).ItemDefinition
in a model, can be specified based on either:
ItemDefinition
specified in the model; possibly restricted with getAllowedValues()
ItemDefinition
(s)FunctionItem
isComposite()
will be false
org.kie.dmn.core.impl.SimpleTypeImpl
getBaseType()
will be different than null
getFields()
will be an empty collection
string
but its values can only be a vowel:<dmn:itemDefinition name="tVowel"> <dmn:typeRef>string</dmn:typeRef> <dmn:allowedValues> <dmn:text>"a", "e", "i", "o", "u"</dmn:text> </dmn:allowedValues> </dmn:itemDefinition>Another example of DMN Simple type, modeling a FEEL
list<number>
:<dmn:itemDefinition name="tNumbers" isCollection="true"> <dmn:typeRef>number</dmn:typeRef> </dmn:itemDefinition>Another example of DMN Simple type, making reference to another
ItemDefinition
specified in the model, modeling a list of just vowels:<dmn:itemDefinition name="tListOfVowels" isCollection="true"> <dmn:typeRef>tVowel</dmn:typeRef> </dmn:itemDefinition>When instead specified by composition:
isComposite()
will be true
org.kie.dmn.core.impl.CompositeTypeImpl
getBaseType()
always return null.
getFields()
will return the collection of fields representing this composition
context<full name: string, age: number>
:<dmn:itemDefinition name="tPerson"> <dmn:itemComponent name="full name"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemComponent> <dmn:itemComponent name="age"> <dmn:typeRef>number</dmn:typeRef> </dmn:itemComponent> </dmn:itemDefinition>
ItemDefinition.isIsCollection()
to true
, indicates that the actual values defined by the type are collections of (allowed) values.isCollection()
.ItemDefinition.getAllowedValues()
attribute lists the possible values or ranges of values in the base type that are allowed in this ItemDefinition.
This is reflected in this DMN type getAllowedValues()
.getFields()
will return the collection of the fields which constitutes the composite type.<dmn:itemDefinition name="tPerson"> <dmn:itemComponent name="full name"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemComponent> <dmn:itemComponent name="age"> <dmn:typeRef>number</dmn:typeRef> </dmn:itemComponent> </dmn:itemDefinition>a call to
getFields()
returns a collection of two entries:
string
number
ItemDefinition
this gets compiled as a DMN type and it is registered in the model's org.kie.dmn.core.impl.DMNModelImpl#getTypeRegistry()
.ItemDefinition
defines an anonymous inner type, which naturally cannot be registered in the type registry since it does not have a globally valid and unique name.<dmn:itemDefinition name="tPerson"> <dmn:itemComponent name="full name"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemComponent> <dmn:itemComponent name="address"> <dmn:itemComponent name="country"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemComponent> <dmn:itemComponent name="zip"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemComponent> </dmn:itemComponent> </dmn:itemDefinition>a call to
getFields()
returns a collection of two entries:
string
getName()
returns address.getFields()
in turn would return a collection of two entries:
string
string
<dmn:itemDefinition name="tPart"> <dmn:itemComponent name="name"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemComponent> <dmn:itemComponent name="grade"> <dmn:typeRef>string</dmn:typeRef> <dmn:allowedValues> <dmn:text>"A", "B", "C"</dmn:text> </dmn:allowedValues> </dmn:itemComponent> </dmn:itemDefinition>a call to
getFields()
returns a collection of two entries:
string
getName()
returns grade.DMNType
, is merely for internal mechanisms adopted by the engine
and does not correspond to any requirement from the DMN specification;
the current valorization of the attributes of this DMNType
follows internal implementation choices and can change any time the convention might need update.
It is strongly advised to discern these representations from normal ItemDefinition
defined in the DMN model,
by making use of the namespace attribute as described above.Modifier and Type | Method and Description |
---|---|
DMNType |
clone() |
List<DMNUnaryTest> |
getAllowedValues() |
DMNType |
getBaseType() |
Map<String,DMNType> |
getFields() |
String |
getId() |
String |
getName() |
String |
getNamespace() |
boolean |
isAssignableValue(Object value)
Check if the value passed as parameter can be assigned to this type.
|
boolean |
isCollection() |
boolean |
isComposite() |
boolean |
isInstanceOf(Object o)
Definition of `instance of` accordingly to FEEL specifications Table 49.
|
String getNamespace()
String getName()
String getId()
boolean isCollection()
boolean isComposite()
DMNType getBaseType()
DMNType clone()
boolean isInstanceOf(Object o)
o
- boolean isAssignableValue(Object value)
value
- List<DMNUnaryTest> getAllowedValues()
Copyright © 2001–2020 JBoss by Red Hat. All rights reserved.