functions.Enumeration.ext Maven / Gradle / Ivy
extension functions::TypeChecks;
extension java::GeneratorCommons;
extension java::Naming;
//cached boolean isEnumeration(uml::Element element):
// element.isInstanceOf("org.eclipse.uml2.uml.Enumeration");
cached uml::Enumeration asEnumeration(uml::Element element):
(uml::Enumeration) element;
cached boolean hasUnknownLiteral(uml::Enumeration enum):
!enum.ownedLiteral.select(e|e.name == "UNKNOWN").isEmpty;
cached List[uml::EnumerationLiteral] getPulicLiterals(JMM::OpenAPIEnumeration enum):
if enum.extensibleEnum
then enum.ownedLiteral.select(e|e.name != "UNKNOWN")
else enum.ownedLiteral;
cached boolean isEnumTypeSlot(uml::Slot slot):
slot.definingFeature.type.isEnumeration();
cached boolean isStringTypeSlot(uml::Slot slot):
slot.definingFeature.type.isStringType();
cached boolean isFloatTypeSlot(uml::Slot slot):
slot.definingFeature.type.isFloatType();
cached List[uml::Slot] getOrderedSlots(uml::EnumerationLiteral literal):
JAVA com.anaptecs.jeaf.fwk.generator.util.GeneratorCommons.getOrderedSlots(org.eclipse.uml2.uml.EnumerationLiteral);
cached String getSlotValue(uml::Slot slot):
if slot == null
then "null"
else if slot.isEnumTypeSlot()
then slot.definingFeature.type.fqn() + "." + slot.value.first().stringValue()
else if slot.isStringTypeSlot()
then "\"" + slot.value.first().stringValue() + "\""
else if slot.isFloatTypeSlot()
then slot.value.first().stringValue() + "f"
else slot.value.first().stringValue();
cached String getMissingMandatorySlots(uml::EnumerationLiteral literal):
literal.javaGetMissingMandatorySlots().toString(", ");
private List[String] javaGetMissingMandatorySlots(uml::EnumerationLiteral literal):
JAVA com.anaptecs.jeaf.fwk.generator.util.GeneratorCommons.getMissingMandatorySlots(org.eclipse.uml2.uml.EnumerationLiteral);