Java 类com.intellij.util.xml.reflect.DomFixedChildDescription 实例源码

项目:intellij-ce-playground    文件:DomBasicsTest.java   
public void testChildrenReflection() throws Throwable {
  final MyElement element =
    createElement("<a><child/><child-element/><child-element/></a>");
  final DomGenericInfo info = element.getGenericInfo();

  final DomFixedChildDescription foo = info.getFixedChildDescription("foo");
  assertFixedChildDescription(foo, element.getFoo(), "foo");

  final DomFixedChildDescription child = info.getFixedChildDescription("child");
  assertFixedChildDescription(child, element.getChild(), "child");

  final DomFixedChildDescription genericChild = info.getFixedChildDescription("generic-value");
  assertGenericChildDescription(genericChild, element.getGenericValue(), "generic-value");

  final DomCollectionChildDescription collectionChild = info.getCollectionChildDescription("child-element");
  assertEquals(element.getChildElements(), collectionChild.getValues(element));
  assertEquals("child-element", collectionChild.getXmlElementName());
  assertEquals(MyElement.class, collectionChild.getType());
  assertEquals(MyElement.class.getMethod("getChildElements"), collectionChild.getGetterMethod().getMethod());

  assertEquals(new HashSet(Arrays.asList(foo, child, collectionChild, genericChild,
                                         info.getAttributeChildrenDescriptions().get(0))),
               new HashSet(info.getChildrenDescriptions())
  );
}
项目:tools-idea    文件:DomBasicsTest.java   
public void testChildrenReflection() throws Throwable {
  final MyElement element =
    createElement("<a><child/><child-element/><child-element/></a>");
  final DomGenericInfo info = element.getGenericInfo();

  final DomFixedChildDescription foo = info.getFixedChildDescription("foo");
  assertFixedChildDescription(foo, element.getFoo(), "foo");

  final DomFixedChildDescription child = info.getFixedChildDescription("child");
  assertFixedChildDescription(child, element.getChild(), "child");

  final DomFixedChildDescription genericChild = info.getFixedChildDescription("generic-value");
  assertGenericChildDescription(genericChild, element.getGenericValue(), "generic-value");

  final DomCollectionChildDescription collectionChild = info.getCollectionChildDescription("child-element");
  assertEquals(element.getChildElements(), collectionChild.getValues(element));
  assertEquals("child-element", collectionChild.getXmlElementName());
  assertEquals(MyElement.class, collectionChild.getType());
  assertEquals(MyElement.class.getMethod("getChildElements"), collectionChild.getGetterMethod().getMethod());

  assertEquals(new HashSet(Arrays.asList(foo, child, collectionChild, genericChild,
                                         info.getAttributeChildrenDescriptions().get(0))),
               new HashSet(info.getChildrenDescriptions()));
}
项目:consulo-xml    文件:DomBasicsTest.java   
public void testChildrenReflection() throws Throwable {
  final MyElement element =
    createElement("<a><child/><child-element/><child-element/></a>");
  final DomGenericInfo info = element.getGenericInfo();

  final DomFixedChildDescription foo = info.getFixedChildDescription("foo");
  assertFixedChildDescription(foo, element.getFoo(), "foo");

  final DomFixedChildDescription child = info.getFixedChildDescription("child");
  assertFixedChildDescription(child, element.getChild(), "child");

  final DomFixedChildDescription genericChild = info.getFixedChildDescription("generic-value");
  assertGenericChildDescription(genericChild, element.getGenericValue(), "generic-value");

  final DomCollectionChildDescription collectionChild = info.getCollectionChildDescription("child-element");
  assertEquals(element.getChildElements(), collectionChild.getValues(element));
  assertEquals("child-element", collectionChild.getXmlElementName());
  assertEquals(MyElement.class, collectionChild.getType());
  assertEquals(MyElement.class.getMethod("getChildElements"), collectionChild.getGetterMethod().getMethod());

  assertEquals(new HashSet(Arrays.asList(foo, child, collectionChild, genericChild,
                                         info.getAttributeChildrenDescriptions().get(0))),
               new HashSet(info.getChildrenDescriptions()));
}
项目:intellij-ce-playground    文件:IndexedElementInvocationHandler.java   
@Override
public final DomElement createPathStableCopy() {
  final DomFixedChildDescription description = getChildDescription();
  final DomElement parentCopy = getParent().createStableCopy();
  return getManager().createStableValue(new Factory<DomElement>() {
    @Override
    public DomElement create() {
      return parentCopy.isValid() ? description.getValues(parentCopy).get(myIndex) : null;
    }
  });
}
项目:intellij-ce-playground    文件:ChildGenericValueColumnInfo.java   
public ChildGenericValueColumnInfo(final String name,
                                   @NotNull final DomFixedChildDescription description,
                                   final TableCellRenderer renderer,
                                   final TableCellEditor editor) {
  super(name, renderer);
  myEditor = editor;
  myChildDescription = description;
}
项目:intellij-ce-playground    文件:DomBasicsTest.java   
private void assertFixedChildDescription(final DomFixedChildDescription description,
                                         final DomElement child,
                                         final String tagName) {
  assertEquals(1, description.getCount());
  assertEquals(Arrays.asList(child), description.getValues(child.getParent()));
  assertEquals(tagName, description.getXmlElementName());
  assertEquals(MyElement.class, description.getType());
  assertEquals(JavaMethod.getMethod(MyElement.class, new JavaMethodSignature("get" + StringUtil.capitalize(tagName))), description.getGetterMethod(0));
}
项目:intellij-ce-playground    文件:DomBasicsTest.java   
private static void assertGenericChildDescription(final DomFixedChildDescription description,
                                           final DomElement child,
                                           final String tagName) {
  assertEquals(1, description.getCount());
  assertEquals(Arrays.asList(child), description.getValues(child.getParent()));
  assertEquals(tagName, description.getXmlElementName());
  assertEquals(GenericDomValue.class, ((ParameterizedType)description.getType()).getRawType());
  assertEquals(JavaMethod.getMethod(MyElement.class, new JavaMethodSignature("getGenericValue")), description.getGetterMethod(0));
}
项目:tools-idea    文件:IndexedElementInvocationHandler.java   
public final DomElement createPathStableCopy() {
  final DomFixedChildDescription description = getChildDescription();
  final DomElement parentCopy = getParent().createStableCopy();
  return getManager().createStableValue(new Factory<DomElement>() {
    public DomElement create() {
      return parentCopy.isValid() ? description.getValues(parentCopy).get(myIndex) : null;
    }
  });
}
项目:tools-idea    文件:ChildGenericValueColumnInfo.java   
public ChildGenericValueColumnInfo(final String name,
                                   @NotNull final DomFixedChildDescription description,
                                   final TableCellRenderer renderer,
                                   final TableCellEditor editor) {
  super(name, renderer);
  myEditor = editor;
  myChildDescription = description;
}
项目:tools-idea    文件:DomBasicsTest.java   
private void assertFixedChildDescription(final DomFixedChildDescription description,
                                         final DomElement child,
                                         final String tagName) throws NoSuchMethodException {
  assertEquals(1, description.getCount());
  assertEquals(Arrays.asList(child), description.getValues(child.getParent()));
  assertEquals(tagName, description.getXmlElementName());
  assertEquals(MyElement.class, description.getType());
  assertEquals(JavaMethod.getMethod(MyElement.class, new JavaMethodSignature("get" + StringUtil.capitalize(tagName))), description.getGetterMethod(0));
}
项目:tools-idea    文件:DomBasicsTest.java   
private static void assertGenericChildDescription(final DomFixedChildDescription description,
                                           final DomElement child,
                                           final String tagName) throws NoSuchMethodException {
  assertEquals(1, description.getCount());
  assertEquals(Arrays.asList(child), description.getValues(child.getParent()));
  assertEquals(tagName, description.getXmlElementName());
  assertEquals(GenericDomValue.class, ((ParameterizedType)description.getType()).getRawType());
  assertEquals(JavaMethod.getMethod(MyElement.class, new JavaMethodSignature("getGenericValue")), description.getGetterMethod(0));
}
项目:consulo-xml    文件:IndexedElementInvocationHandler.java   
public final DomElement createPathStableCopy() {
  final DomFixedChildDescription description = getChildDescription();
  final DomElement parentCopy = getParent().createStableCopy();
  return getManager().createStableValue(new Factory<DomElement>() {
    public DomElement create() {
      return parentCopy.isValid() ? description.getValues(parentCopy).get(myIndex) : null;
    }
  });
}
项目:consulo-xml    文件:DomBasicsTest.java   
private void assertFixedChildDescription(final DomFixedChildDescription description,
                                         final DomElement child,
                                         final String tagName) throws NoSuchMethodException {
  assertEquals(1, description.getCount());
  assertEquals(Arrays.asList(child), description.getValues(child.getParent()));
  assertEquals(tagName, description.getXmlElementName());
  assertEquals(MyElement.class, description.getType());
  assertEquals(JavaMethod.getMethod(MyElement.class, new JavaMethodSignature("get" + StringUtil.capitalize(tagName))), description.getGetterMethod(0));
}
项目:consulo-xml    文件:DomBasicsTest.java   
private static void assertGenericChildDescription(final DomFixedChildDescription description,
                                           final DomElement child,
                                           final String tagName) throws NoSuchMethodException {
  assertEquals(1, description.getCount());
  assertEquals(Arrays.asList(child), description.getValues(child.getParent()));
  assertEquals(tagName, description.getXmlElementName());
  assertEquals(GenericDomValue.class, ((ParameterizedType)description.getType()).getRawType());
  assertEquals(JavaMethod.getMethod(MyElement.class, new JavaMethodSignature("getGenericValue")), description.getGetterMethod(0));
}
项目:consulo-xml    文件:ChildGenericValueColumnInfo.java   
public ChildGenericValueColumnInfo(final String name,
                                   @NotNull final DomFixedChildDescription description,
                                   final TableCellRenderer renderer,
                                   final TableCellEditor editor) {
  super(name, renderer);
  myEditor = editor;
  myChildDescription = description;
}
项目:intellij-ce-playground    文件:ChildGenericValueColumnInfo.java   
public ChildGenericValueColumnInfo(final String name, final DomFixedChildDescription description, final TableCellEditor editor) {
  this(name, description, new DefaultTableCellRenderer(), editor);
}
项目:intellij-ce-playground    文件:ChildGenericValueColumnInfo.java   
protected final DomFixedChildDescription getChildDescription() {
  return myChildDescription;
}
项目:tools-idea    文件:ChildGenericValueColumnInfo.java   
public ChildGenericValueColumnInfo(final String name, final DomFixedChildDescription description, final TableCellEditor editor) {
  this(name, description, new DefaultTableCellRenderer(), editor);
}
项目:tools-idea    文件:ChildGenericValueColumnInfo.java   
protected final DomFixedChildDescription getChildDescription() {
  return myChildDescription;
}
项目:consulo-xml    文件:ChildGenericValueColumnInfo.java   
public ChildGenericValueColumnInfo(final String name, final DomFixedChildDescription description, final TableCellEditor editor) {
  this(name, description, new DefaultTableCellRenderer(), editor);
}
项目:consulo-xml    文件:ChildGenericValueColumnInfo.java   
protected final DomFixedChildDescription getChildDescription() {
  return myChildDescription;
}