/** * Provides classes for working with MyBatis mapper xml files and their content. */ import java /** * MyBatis Mapper XML file. */ class MyBatisMapperXmlFile extends XmlFile { MyBatisMapperXmlFile() { count(XmlElement e | e = this.getAChild()) = 1 and this.getAChild().getName() = "mapper" } } /** DEPRECATED: Alias for MyBatisMapperXmlFile */ deprecated class MyBatisMapperXMLFile = MyBatisMapperXmlFile; /** * An XML element in a `MyBatisMapperXMLFile`. */ class MyBatisMapperXmlElement extends XmlElement { MyBatisMapperXmlElement() { this.getFile() instanceof MyBatisMapperXmlFile } /** * Gets the value for this element, with leading and trailing whitespace trimmed. */ string getValue() { result = this.allCharactersString().trim() } /** * Gets the reference type bound to MyBatis Mapper XML File. */ RefType getNamespaceRefType() { result.getQualifiedName() = this.getAttribute("namespace").getValue() } } /** DEPRECATED: Alias for MyBatisMapperXmlElement */ deprecated class MyBatisMapperXMLElement = MyBatisMapperXmlElement; /** * An MyBatis Mapper sql operation element. */ abstract class MyBatisMapperSqlOperation extends MyBatisMapperXmlElement { /** * Gets the value of the `id` attribute of MyBatis Mapper sql operation element. */ string getId() { result = this.getAttribute("id").getValue() } /** * Gets the `` element in a `MyBatisMapperSqlOperation`. */ MyBatisMapperInclude getInclude() { result = this.getAChild*() } /** * Gets the method bound to MyBatis Mapper XML File. */ Method getMapperMethod() { result.getName() = this.getId() and result.getDeclaringType() = this.getParent().(MyBatisMapperXmlElement).getNamespaceRefType() } } /** * A `` element in a `MyBatisMapperSqlOperation`. */ class MyBatisMapperInsert extends MyBatisMapperSqlOperation { MyBatisMapperInsert() { this.getName() = "insert" } } /** * A `` element in a `MyBatisMapperSqlOperation`. */ class MyBatisMapperUpdate extends MyBatisMapperSqlOperation { MyBatisMapperUpdate() { this.getName() = "update" } } /** * A `` element in a `MyBatisMapperSqlOperation`. */ class MyBatisMapperDelete extends MyBatisMapperSqlOperation { MyBatisMapperDelete() { this.getName() = "delete" } } /** * A `