Esempio n. 1
0
 @NotNull
 public static List<XmlTag> getElementTags(@NotNull Collection<? extends DomElement> list) {
   ArrayList<XmlTag> result = new ArrayList<>(list.size());
   for (DomElement element : list) {
     XmlTag tag = element.getXmlTag();
     if (tag != null) {
       result.add(tag);
     }
   }
   return result;
 }
Esempio n. 2
0
 @NotNull
 public static String[] getElementNames(@NotNull Collection<? extends DomElement> list) {
   ArrayList<String> result = new ArrayList<>(list.size());
   if (list.size() > 0) {
     for (DomElement element : list) {
       String name = element.getGenericInfo().getElementName(element);
       if (name != null) {
         result.add(name);
       }
     }
   }
   return ArrayUtil.toStringArray(result);
 }
Esempio n. 3
0
  public static List<? extends DomElement> getIdentitySiblings(DomElement element) {
    final GenericDomValue nameDomElement = element.getGenericInfo().getNameDomElement(element);
    if (nameDomElement == null) return Collections.emptyList();

    final NameValue nameValue = nameDomElement.getAnnotation(NameValue.class);
    if (nameValue == null || !nameValue.unique()) return Collections.emptyList();

    final String stringValue = ElementPresentationManager.getElementName(element);
    if (stringValue == null) return Collections.emptyList();

    final DomElement scope = element.getManager().getIdentityScope(element);
    if (scope == null) return Collections.emptyList();

    final DomGenericInfo domGenericInfo = scope.getGenericInfo();
    final String tagName = element.getXmlElementName();
    final DomCollectionChildDescription childDescription =
        domGenericInfo.getCollectionChildDescription(tagName, element.getXmlElementNamespaceKey());
    if (childDescription != null) {
      final ArrayList<DomElement> list = new ArrayList<>(childDescription.getValues(scope));
      list.remove(element);
      return list;
    }
    return Collections.emptyList();
  }