update copyright
[fedora-idea.git] / xml / dom-impl / src / com / intellij / util / xml / impl / DomGenericInfoEx.java
blob8ccaca91a5a2baed07a2300e434fef791f360458
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.util.xml.impl;
18 import com.intellij.openapi.util.text.StringUtil;
19 import com.intellij.util.Processor;
20 import com.intellij.util.xml.EvaluatedXmlName;
21 import com.intellij.util.xml.JavaMethod;
22 import com.intellij.util.xml.XmlName;
23 import com.intellij.util.xml.reflect.AbstractDomChildrenDescription;
24 import com.intellij.util.xml.reflect.DomGenericInfo;
25 import org.jetbrains.annotations.NotNull;
26 import org.jetbrains.annotations.Nullable;
28 import java.util.List;
30 /**
31 * @author peter
33 public abstract class DomGenericInfoEx implements DomGenericInfo {
35 public abstract boolean checkInitialized();
37 public abstract Invocation createInvocation(final JavaMethod method);
39 @NotNull
40 public abstract List<AttributeChildDescriptionImpl> getAttributeChildrenDescriptions();
42 @Nullable
43 public final AbstractDomChildrenDescription findChildrenDescription(DomInvocationHandler handler, final String localName, String namespace,
44 boolean attribute,
45 final String qName) {
46 for (final AbstractDomChildrenDescription description : getChildrenDescriptions()) {
47 if (description instanceof DomChildDescriptionImpl && description instanceof AttributeChildDescriptionImpl == attribute) {
48 final XmlName xmlName = ((DomChildDescriptionImpl)description).getXmlName();
49 if (attribute && StringUtil.isEmpty(namespace) && xmlName.getLocalName().equals(localName)) return description;
51 final EvaluatedXmlName evaluatedXmlName = handler.createEvaluatedXmlName(xmlName);
52 if (DomImplUtil.isNameSuitable(evaluatedXmlName, localName, qName, namespace, handler.getFile())) {
53 return description;
57 return attribute ? null : getCustomNameChildrenDescription();
60 public abstract boolean processAttributeChildrenDescriptions(Processor<AttributeChildDescriptionImpl> processor);