@Test public void testBuildRegistrationAddsString_WithPkg() { PropertyRegistrarClassGenerator gen = new PropertyRegistrarClassGenerator( simpleCompileUnit(), AndHowCompileProcessor.class, runDate); String adds = gen.buildRegistrationAddsString(); String eachAdds[] = adds.trim().split("[\\t\\n\\r\\f]+"); assertEquals(2, eachAdds.length); assertEquals("list.add(\"" + PROP1_NAME + "\");", eachAdds[0]); assertEquals("list.add(\"" + PROP2_NAME + "\");", eachAdds[1]); }
protected String buildRegistrationAddsString() { StringBuilder buf = new StringBuilder(); PropertyRegistrationList regList = compUnit.getRegistrations(); regList.sort(); PropertyRegistration prevReg = null; for (PropertyRegistration pr : regList) { if ((prevReg != null && pr.compareInnerPathTo(prevReg) != 0) || (prevReg == null && pr.getInnerPathLength() > 0)) { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\""); for (String step : pr.getInnerPath()) { buf.append(", \"").append(step).append("\""); } buf.append(");").append(System.lineSeparator()); } else { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\");").append(System.lineSeparator()); } prevReg = pr; } return buf.toString(); }
PropertyRegistrarClassGenerator { protected String buildRegistrationAddsString() { StringBuilder buf = new StringBuilder(); PropertyRegistrationList regList = compUnit.getRegistrations(); regList.sort(); PropertyRegistration prevReg = null; for (PropertyRegistration pr : regList) { if ((prevReg != null && pr.compareInnerPathTo(prevReg) != 0) || (prevReg == null && pr.getInnerPathLength() > 0)) { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\""); for (String step : pr.getInnerPath()) { buf.append(", \"").append(step).append("\""); } buf.append(");").append(System.lineSeparator()); } else { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\");").append(System.lineSeparator()); } prevReg = pr; } return buf.toString(); } }
PropertyRegistrarClassGenerator { protected String buildRegistrationAddsString() { StringBuilder buf = new StringBuilder(); PropertyRegistrationList regList = compUnit.getRegistrations(); regList.sort(); PropertyRegistration prevReg = null; for (PropertyRegistration pr : regList) { if ((prevReg != null && pr.compareInnerPathTo(prevReg) != 0) || (prevReg == null && pr.getInnerPathLength() > 0)) { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\""); for (String step : pr.getInnerPath()) { buf.append(", \"").append(step).append("\""); } buf.append(");").append(System.lineSeparator()); } else { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\");").append(System.lineSeparator()); } prevReg = pr; } return buf.toString(); } PropertyRegistrarClassGenerator(CompileUnit compUnit, Class<?> generatingClass, Calendar runDate); }
PropertyRegistrarClassGenerator { protected String buildRegistrationAddsString() { StringBuilder buf = new StringBuilder(); PropertyRegistrationList regList = compUnit.getRegistrations(); regList.sort(); PropertyRegistration prevReg = null; for (PropertyRegistration pr : regList) { if ((prevReg != null && pr.compareInnerPathTo(prevReg) != 0) || (prevReg == null && pr.getInnerPathLength() > 0)) { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\""); for (String step : pr.getInnerPath()) { buf.append(", \"").append(step).append("\""); } buf.append(");").append(System.lineSeparator()); } else { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\");").append(System.lineSeparator()); } prevReg = pr; } return buf.toString(); } PropertyRegistrarClassGenerator(CompileUnit compUnit, Class<?> generatingClass, Calendar runDate); String getTemplatePath(); String getTemplate(); String generateSource(); }
PropertyRegistrarClassGenerator { protected String buildRegistrationAddsString() { StringBuilder buf = new StringBuilder(); PropertyRegistrationList regList = compUnit.getRegistrations(); regList.sort(); PropertyRegistration prevReg = null; for (PropertyRegistration pr : regList) { if ((prevReg != null && pr.compareInnerPathTo(prevReg) != 0) || (prevReg == null && pr.getInnerPathLength() > 0)) { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\""); for (String step : pr.getInnerPath()) { buf.append(", \"").append(step).append("\""); } buf.append(");").append(System.lineSeparator()); } else { buf.append("\t\tlist.add(\"").append(pr.getPropertyName()).append("\");").append(System.lineSeparator()); } prevReg = pr; } return buf.toString(); } PropertyRegistrarClassGenerator(CompileUnit compUnit, Class<?> generatingClass, Calendar runDate); String getTemplatePath(); String getTemplate(); String generateSource();  }