All Downloads are FREE. Search and download functionalities are using the official Maven repository.

functions.Enumeration.ext Maven / Gradle / Ivy

There is a newer version: 1.24.1
Show newest version
extension functions::TypeChecks;
extension java::GeneratorCommons;
extension java::Naming;


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);

    




© 2015 - 2024 Weber Informatics LLC | Privacy Policy