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

functions.Property.ext Maven / Gradle / Ivy

There is a newer version: 1.24.1
Show newest version
import uml;
import JMM;

extension functions::TypeChecks;
extension functions::SoftLink;
extension functions::OpenAPISpecification;
extension java::OpenAPIFunctions;
extension java::GeneratorCommons;

cached boolean isProperty(uml::Element element):
    element.isInstanceOf("org.eclipse.uml2.uml.Property");
    
cached uml::Property asProperty(uml::Element element):
    (uml::Property) element;
    
boolean isTransient(uml::Property property):
  property.isStereotypeApplied("Transient") || property.isStereotypeApplied("CompositeDataTypePublicField");

cached boolean belongsToBidirectionalAssociation(uml::Property property):
    property.association != null && property.association.getAllAttributes().select(e|e.isNavigable()).size > 1;
    
cached boolean belongsToTransientBidirectionalAssociation(uml::Property property):
    property.belongsToBidirectionalAssociation() && property.association.getAllAttributes().selectFirst(e|e.isTransient()) != null;
    
cached OpenAPI3Specification getOwnOpenAPISpecification(Property property):
    property.getNearestPackage().getOpenAPISpecificationForPackage();
    
cached OpenAPI3Specification getReferencedOpenAPISpecification(Property property):
    property.type.getNearestPackage().getOpenAPISpecificationForPackage();

private cached OpenAPI3Specification getOpenAPISpecificationForPackage(Package package):
    package.getRelationships().typeSelect(Dependency).client.typeSelect(OpenAPI3Specification).first();
    
    
cached boolean checkOpenAPIDependencies(Property property):
    if property.type.isBasicOpenAPIType() || property.type == null || property.getReferencedOpenAPISpecification() == null || property.isSoftLink()
    then true
    else property.getOwnOpenAPISpecification() == property.getReferencedOpenAPISpecification() || property.getOwnOpenAPISpecification().hasDependency(property.getReferencedOpenAPISpecification());

cached boolean checkForOrphanedOpenAPITypes(Property property):
    if property.type.isBasicOpenAPIType() || property.type == null
    then true
    else property.getReferencedOpenAPISpecification() != null;
    




© 2015 - 2024 Weber Informatics LLC | Privacy Policy