Java Code Examples for org.mybatis.generator.api.dom.xml.Attribute#getValue()
The following examples show how to use
org.mybatis.generator.api.dom.xml.Attribute#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RowBoundsPlugin.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
/** * Use the method copy constructor to create a new element. * * @param fullyQualifiedTable the table * @param method the method */ private void copyAndSaveElement(XmlElement element, FullyQualifiedTable fqt) { XmlElement newElement = new XmlElement(element); // remove old id attribute and add a new one with the new name for (Iterator<Attribute> iterator = newElement.getAttributes().iterator(); iterator.hasNext();) { Attribute attribute = iterator.next(); if ("id".equals(attribute.getName())) { iterator.remove(); Attribute newAttribute = new Attribute("id", attribute.getValue() + "WithRowbounds"); //$NON-NLS-2$ newElement.addAttribute(newAttribute); break; } } // save the new element locally. We'll add it to the document // later List<XmlElement> elements = elementsToAdd.computeIfAbsent(fqt, k -> new ArrayList<>()); elements.add(newElement); }
Example 2
Source File: RowBoundsPlugin.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
/** * Use the method copy constructor to create a new element * * @param fullyQualifiedTable * @param method */ private void copyAndSaveElement(XmlElement element, FullyQualifiedTable fqt) { XmlElement newElement = new XmlElement(element); // remove old id attribute and add a new one with the new name for (Iterator<Attribute> iterator = newElement.getAttributes().iterator(); iterator.hasNext();) { Attribute attribute = iterator.next(); if ("id".equals(attribute.getName())) { //$NON-NLS-1$ iterator.remove(); Attribute newAttribute = new Attribute("id", attribute.getValue() + "WithRowbounds"); //$NON-NLS-1$ //$NON-NLS-2$ newElement.addAttribute(newAttribute); break; } } // save the new element locally. We'll add it to the document // later List<XmlElement> elements = elementsToAdd.get(fqt); if (elements == null) { elements = new ArrayList<XmlElement>(); elementsToAdd.put(fqt, elements); } elements.add(newElement); }
Example 3
Source File: RowBoundsPlugin.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
/** * Use the method copy constructor to create a new element * * @param fullyQualifiedTable * @param method */ private void copyAndSaveElement(XmlElement element, FullyQualifiedTable fqt) { XmlElement newElement = new XmlElement(element); // remove old id attribute and add a new one with the new name for (Iterator<Attribute> iterator = newElement.getAttributes().iterator(); iterator.hasNext();) { Attribute attribute = iterator.next(); if ("id".equals(attribute.getName())) { //$NON-NLS-1$ iterator.remove(); Attribute newAttribute = new Attribute("id", attribute.getValue() + "WithRowbounds"); //$NON-NLS-1$ //$NON-NLS-2$ newElement.addAttribute(newAttribute); break; } } // save the new element locally. We'll add it to the document // later List<XmlElement> elements = elementsToAdd.get(fqt); if (elements == null) { elements = new ArrayList<XmlElement>(); elementsToAdd.put(fqt, elements); } elements.add(newElement); }
Example 4
Source File: FormatTools.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 找出节点ID值 * @param element * @return */ private static String getIdFromElement(XmlElement element) { for (Attribute attribute : element.getAttributes()) { if (attribute.getName().equals("id")) { return attribute.getValue(); } } return null; }
Example 5
Source File: RenameExampleClassAndMethodsPlugin.java From mybatis-generator-plugins with Apache License 2.0 | 5 votes |
boolean renameElement(XmlElement element) { for (int i = 0; i < element.getAttributes().size(); i++) { Attribute attribute = element.getAttributes().get(i); if (XML_ID_ATTRIBUTE.equals(attribute.getName())) { String oldValue = attribute.getValue(); Matcher matcher = classMethodPattern.matcher(oldValue); String newValue = matcher.replaceAll(classMethodReplaceString); Attribute newAtt = new Attribute(attribute.getName(), newValue); element.getAttributes().set(i, newAtt); } } return true; }
Example 6
Source File: AttributeRenderer.java From mapper-generator-javafx with Apache License 2.0 | 4 votes |
public String render(Attribute attribute) { return attribute.getName() + "=\"" + attribute.getValue() + "\""; }
Example 7
Source File: XmlElementTools.java From mybatis-generator-plugin with Apache License 2.0 | 2 votes |
/** * 拷贝 * @param attribute * @return */ public static Attribute clone(Attribute attribute) { return new Attribute(attribute.getName(), attribute.getValue()); }