@Test public void testClassNameCorrectly() { assertThat(nameHelper.getClassName("foo", NODE), is("foo")); assertThat(nameHelper.getClassName("foo", node("title", "bar")), is("foo")); assertThat(nameHelper.getClassName("foo", node("javaName", "bar")), is("bar")); assertThat(nameHelper.getClassName("foo", node("javaName", "bar").put("title", "abc")), is("bar")); NameHelper nameHelper = helper(true); assertThat(nameHelper.getClassName("foo", node("title", "bar")), is("Bar")); assertThat(nameHelper.getClassName("foo", node("title", "i am bar")), is("IAmBar")); assertThat(nameHelper.getClassName("foo", node("javaName", "bar")), is("bar")); assertThat(nameHelper.getClassName("foo", node("javaName", "bar").put("title", "abc")), is("bar")); }
public String getClassName(String propertyName, JsonNode node) { if (node != null) { if (node.has("javaName")) { propertyName = node.get("javaName").textValue(); } else if (generationConfig.isUseTitleAsClassname() && node.has("title")) { String title = node.get("title").textValue(); propertyName = WordUtils.capitalize(title).replaceAll(" ", ""); } } return propertyName; }
NameHelper { public String getClassName(String propertyName, JsonNode node) { if (node != null) { if (node.has("javaName")) { propertyName = node.get("javaName").textValue(); } else if (generationConfig.isUseTitleAsClassname() && node.has("title")) { String title = node.get("title").textValue(); propertyName = WordUtils.capitalize(title).replaceAll(" ", ""); } } return propertyName; } }
NameHelper { public String getClassName(String propertyName, JsonNode node) { if (node != null) { if (node.has("javaName")) { propertyName = node.get("javaName").textValue(); } else if (generationConfig.isUseTitleAsClassname() && node.has("title")) { String title = node.get("title").textValue(); propertyName = WordUtils.capitalize(title).replaceAll(" ", ""); } } return propertyName; } NameHelper(GenerationConfig generationConfig); }
NameHelper { public String getClassName(String propertyName, JsonNode node) { if (node != null) { if (node.has("javaName")) { propertyName = node.get("javaName").textValue(); } else if (generationConfig.isUseTitleAsClassname() && node.has("title")) { String title = node.get("title").textValue(); propertyName = WordUtils.capitalize(title).replaceAll(" ", ""); } } return propertyName; } NameHelper(GenerationConfig generationConfig); String getBuilderTypeParameterName(JDefinedClass instanceClass); String replaceIllegalCharacters(String name); String normalizeName(String name); String capitalizeTrailingWords(String name); String getPropertyName(String jsonFieldName, JsonNode node); String getSetterName(String propertyName, JsonNode node); String getBuilderName(String propertyName, JsonNode node); String getFieldName(String propertyName, JsonNode node); String getClassName(String propertyName, JsonNode node); String getGetterName(String propertyName, JType type, JsonNode node); String getBaseBuilderClassName(JClass outerClass); String getBaseBuilderClassNameSuffix(JClass outerClass); String getBuilderClassName(JClass outerClass); String getBuilderClassNameSuffix(JClass outerClass); String getUniqueClassName(String nodeName, JsonNode node, JPackage _package); String getClassName(String nodeName, JsonNode node, JPackage _package); }
NameHelper { public String getClassName(String propertyName, JsonNode node) { if (node != null) { if (node.has("javaName")) { propertyName = node.get("javaName").textValue(); } else if (generationConfig.isUseTitleAsClassname() && node.has("title")) { String title = node.get("title").textValue(); propertyName = WordUtils.capitalize(title).replaceAll(" ", ""); } } return propertyName; } NameHelper(GenerationConfig generationConfig); String getBuilderTypeParameterName(JDefinedClass instanceClass); String replaceIllegalCharacters(String name); String normalizeName(String name); String capitalizeTrailingWords(String name); String getPropertyName(String jsonFieldName, JsonNode node); String getSetterName(String propertyName, JsonNode node); String getBuilderName(String propertyName, JsonNode node); String getFieldName(String propertyName, JsonNode node); String getClassName(String propertyName, JsonNode node); String getGetterName(String propertyName, JType type, JsonNode node); String getBaseBuilderClassName(JClass outerClass); String getBaseBuilderClassNameSuffix(JClass outerClass); String getBuilderClassName(JClass outerClass); String getBuilderClassNameSuffix(JClass outerClass); String getUniqueClassName(String nodeName, JsonNode node, JPackage _package); String getClassName(String nodeName, JsonNode node, JPackage _package); static final String ILLEGAL_CHARACTER_REGEX; }