@Test public void testGetRootSimpleName() { CompileUnit cu = new CompileUnit("org.big.comp.MyClass"); assertEquals("MyClass", cu.getRootSimpleName()); cu = new CompileUnit("a.MyClass"); assertEquals("MyClass", cu.getRootSimpleName()); cu = new CompileUnit("a.b.MyClass"); assertEquals("MyClass", cu.getRootSimpleName()); cu = new CompileUnit("MyClass"); assertEquals("MyClass", cu.getRootSimpleName()); }
public String getRootSimpleName() { int dotPos = classCanonName.lastIndexOf("."); if (dotPos > 0) { return classCanonName.substring(dotPos + 1); } else { return classCanonName; } }
CompileUnit { public String getRootSimpleName() { int dotPos = classCanonName.lastIndexOf("."); if (dotPos > 0) { return classCanonName.substring(dotPos + 1); } else { return classCanonName; } } }
CompileUnit { public String getRootSimpleName() { int dotPos = classCanonName.lastIndexOf("."); if (dotPos > 0) { return classCanonName.substring(dotPos + 1); } else { return classCanonName; } } CompileUnit(String classCanonName); }
CompileUnit { public String getRootSimpleName() { int dotPos = classCanonName.lastIndexOf("."); if (dotPos > 0) { return classCanonName.substring(dotPos + 1); } else { return classCanonName; } } CompileUnit(String classCanonName); boolean isInitClass(); void setInitClass(boolean initClass); boolean istestInitClass(); void setTestInitClass(boolean testInitClass); void pushType(SimpleType simpleName); void pushType(String name, boolean _static); SimpleType popType(); boolean addProperty(String name, boolean _static, boolean _final); List<SimpleType> getInnerPath(); List<String> getInnerPathNames(); String getRootCanonicalName(); String getRootSimpleName(); String getRootPackageName(); PropertyRegistrationList getRegistrations(); List<CompileProblem> getProblems(); boolean hasErrors(); boolean hasRegistrations(); }
CompileUnit { public String getRootSimpleName() { int dotPos = classCanonName.lastIndexOf("."); if (dotPos > 0) { return classCanonName.substring(dotPos + 1); } else { return classCanonName; } } CompileUnit(String classCanonName); boolean isInitClass(); void setInitClass(boolean initClass); boolean istestInitClass(); void setTestInitClass(boolean testInitClass); void pushType(SimpleType simpleName); void pushType(String name, boolean _static); SimpleType popType(); boolean addProperty(String name, boolean _static, boolean _final); List<SimpleType> getInnerPath(); List<String> getInnerPathNames(); String getRootCanonicalName(); String getRootSimpleName(); String getRootPackageName(); PropertyRegistrationList getRegistrations(); List<CompileProblem> getProblems(); boolean hasErrors(); boolean hasRegistrations();  }