mbien commented on code in PR #6478:
URL: https://github.com/apache/netbeans/pull/6478#discussion_r1334765064
##########
java/maven.grammar/src/org/netbeans/modules/maven/grammar/spi/AbstractSchemaBasedGrammar.java:
##########
@@ -135,30 +136,22 @@ protected final org.jdom.Element
findNonTypedContent(org.jdom.Element root) {
}
- protected final org.jdom.Element findTypeContent(final String type,
org.jdom.Element docRoot) {
- @SuppressWarnings("unchecked")
- List<org.jdom.Element> lst = docRoot.getContent(new Filter() {
- @Override
- public boolean matches(Object match) {
- if (match instanceof org.jdom.Element) {
- org.jdom.Element el = (org.jdom.Element)match;
- if ("complexType".equals(el.getName()) &&
type.equals(el.getAttributeValue("name"))) { //NOI18N
- return true;
- }
+ protected final org.jdom2.Element findTypeContent(final String type,
org.jdom2.Element docRoot) {
+ List<Content> lst = docRoot.getContent();
+ for (Content c : lst) {
+ if (c instanceof org.jdom2.Element) {
+ org.jdom2.Element el = (org.jdom2.Element)c;
+ if ("complexType".equals(el.getName()) &&
type.equals(el.getAttributeValue("name"))) { //NOI18N
+ return el.getChild("all", docRoot.getNamespace()); //NOI18N
}
- return false;
}
Review Comment:
new version should be more efficient since it returns as soon the element is
found, nice!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists