@Test public void testGetterNamedCorrectly() { assertThat(nameHelper.getGetterName("foo", new JCodeModel().BOOLEAN, NODE), is("isFoo")); assertThat(nameHelper.getGetterName("foo", new JCodeModel().INT, NODE), is("getFoo")); assertThat(nameHelper.getGetterName("oAuth2State", new JCodeModel().INT, NODE), is("getoAuth2State")); assertThat(nameHelper.getGetterName("URL", new JCodeModel().INT, NODE), is("getUrl")); }
public String getGetterName(String propertyName, JType type, JsonNode node) { propertyName = getPropertyNameForAccessor(propertyName, node); String prefix = type.equals(type.owner()._ref(boolean.class)) ? "is" : "get"; String getterName; if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { getterName = prefix + propertyName; } else { getterName = prefix + capitalize(propertyName); } if (getterName.equals("getClass")) { getterName = "getClass_"; } return getterName; }
NameHelper { public String getGetterName(String propertyName, JType type, JsonNode node) { propertyName = getPropertyNameForAccessor(propertyName, node); String prefix = type.equals(type.owner()._ref(boolean.class)) ? "is" : "get"; String getterName; if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { getterName = prefix + propertyName; } else { getterName = prefix + capitalize(propertyName); } if (getterName.equals("getClass")) { getterName = "getClass_"; } return getterName; } }
NameHelper { public String getGetterName(String propertyName, JType type, JsonNode node) { propertyName = getPropertyNameForAccessor(propertyName, node); String prefix = type.equals(type.owner()._ref(boolean.class)) ? "is" : "get"; String getterName; if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { getterName = prefix + propertyName; } else { getterName = prefix + capitalize(propertyName); } if (getterName.equals("getClass")) { getterName = "getClass_"; } return getterName; } NameHelper(GenerationConfig generationConfig); }
NameHelper { public String getGetterName(String propertyName, JType type, JsonNode node) { propertyName = getPropertyNameForAccessor(propertyName, node); String prefix = type.equals(type.owner()._ref(boolean.class)) ? "is" : "get"; String getterName; if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { getterName = prefix + propertyName; } else { getterName = prefix + capitalize(propertyName); } if (getterName.equals("getClass")) { getterName = "getClass_"; } return getterName; } 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 getGetterName(String propertyName, JType type, JsonNode node) { propertyName = getPropertyNameForAccessor(propertyName, node); String prefix = type.equals(type.owner()._ref(boolean.class)) ? "is" : "get"; String getterName; if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { getterName = prefix + propertyName; } else { getterName = prefix + capitalize(propertyName); } if (getterName.equals("getClass")) { getterName = "getClass_"; } return getterName; } 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; }