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

functions.SoftLink.ext Maven / Gradle / Ivy

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

cached boolean isSoftLink(uml::Element element):
    element.isStereotypeApplied("SoftLink");
    
cached JMM::SoftLink asSoftLink(uml::Element element):
    (JMM::SoftLink) element;

cached String getJavaSoftLinkType(JMM::SoftLink softLink):
    if (softLink.softLinkType.name == "CustomGenericType")
    then getJavaGenericSoftLinkType()
    else softLink.softLinkType.name;

cached String getMultivaluedJavaSoftLinkType(JMM::SoftLink softLink):
    if (softLink.softLinkType.name == "CustomGenericType")
    then getJavaGenericSoftLinkType()
    else softLink.softLinkType.name.toFirstUpper();

cached String getJavaGenericSoftLinkType():
    getSystemProperty("switch.gen.java.generic.soft.link.type");
    
cached String getOpenAPIGenericSoftLinkType():
    getSystemProperty("switch.gen.openapi.generic.soft.link.type", "string");

private cached String getSoftLinkSuffix():
    getSystemProperty("switch.gen.openapi.generic.soft.link.suffix", "");
    
cached String getSoftLinkPropertyName(uml::Property property):
    if property.isMultivalued() && property.name.endsWith("s")
    then property.name.subString(0, property.name.length-1) + getSoftLinkSuffix() + "s"
    else property.name + getSoftLinkSuffix();
    
cached String getSoftLinkAwarePropertyName(uml::Property property):
    if property.isSoftLink()
    then property.getSoftLinkPropertyName()
    else property.name;
    




© 2015 - 2024 Weber Informatics LLC | Privacy Policy