public void visitFieldName(FieldName aFieldName) { out.print("FieldName("); out.print("value="); if (aFieldName.getValue() != null) { out.print(aFieldName.getValue()); } else { out.print("null"); } out.println(")"); }
@Test public void testFieldNameOf() throws Exception { String name = "foo"; Assert.assertTrue("foo".equals(FieldName.of("foo"))); Assert.assertTrue("bar".equals(FieldName.of("bar"))); new AssertedFailure(FieldName.FieldNameNotFoundException.class) { @Override protected void thisMustFail() throws Throwable { FieldName.of("buh"); } }; Assert.assertTrue("x".equals(FieldName.of(E2.class, "x"))); Assert.assertTrue("y".equals(FieldName.of(E2.class, "y"))); }
public void visitNamesItem(NamesItem aNamesItem) { out.print("NamesItem("); ++indentLevel; out.println(); printIndent(); out.print("names="); if (aNamesItem.getNames() != null) { out.println("["); ++indentLevel; for (FieldName e : aNamesItem.getNames()) { printIndent(); e.visit(this); } --indentLevel; printIndent(); out.println("]"); } else { out.println("null"); } --indentLevel; printIndent(); out.println(")"); }