Class NameHelper

java.lang.Object
org.jsonschema2pojo.util.NameHelper

public class NameHelper extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • getBuilderTypeParameterName

      public String getBuilderTypeParameterName(com.sun.codemodel.JDefinedClass instanceClass)
    • replaceIllegalCharacters

      public String replaceIllegalCharacters(String name)
    • normalizeName

      public String normalizeName(String name)
    • capitalizeTrailingWords

      public String capitalizeTrailingWords(String name)
    • getPropertyName

      public String getPropertyName(String jsonFieldName, com.fasterxml.jackson.databind.JsonNode node)
      Convert jsonFieldName into the equivalent Java field name by replacing illegal characters and normalizing it.
      Parameters:
      jsonFieldName - the name of the JSON property
      node - the JsonNode representing the schema for this property
      Returns:
      a safe, appropriate Java field name
    • getSetterName

      public String getSetterName(String propertyName, com.fasterxml.jackson.databind.JsonNode node)
      Generate setter method name for property.
      Parameters:
      propertyName - the name of the property being set
      node - the JsonNode representing the schema for this property
      Returns:
      a safe, appropriate name for the Java setter method
    • getBuilderName

      public String getBuilderName(String propertyName, com.fasterxml.jackson.databind.JsonNode node)
      Generate builder method name for property (like withXxx).
      Parameters:
      propertyName - the name of the property being added by this builder
      node - the JsonNode representing the schema for this property
      Returns:
      a safe, appropriate name for the Java builder method
    • getFieldName

      public String getFieldName(String propertyName, com.fasterxml.jackson.databind.JsonNode node)
      Generate a name for the class field that will hold this property.
      Parameters:
      propertyName - the name of the JSON property being added as a field
      node - the JsonNode representing the schema for this property
      Returns:
      a safe, appropriate name for the Java class field
    • getClassName

      public String getClassName(String propertyName, com.fasterxml.jackson.databind.JsonNode node)
    • getGetterName

      public String getGetterName(String propertyName, com.sun.codemodel.JType type, com.fasterxml.jackson.databind.JsonNode node)
      Generate getter method name for property.
      Parameters:
      propertyName - the name of the property this getter will return
      node - the JsonNode representing the schema for this property
      Returns:
      a safe, appropriate name for the Java getter method
    • getBaseBuilderClassName

      public String getBaseBuilderClassName(com.sun.codemodel.JClass outerClass)
    • getBaseBuilderClassNameSuffix

      public String getBaseBuilderClassNameSuffix(com.sun.codemodel.JClass outerClass)
    • getBuilderClassName

      public String getBuilderClassName(com.sun.codemodel.JClass outerClass)
    • getBuilderClassNameSuffix

      public String getBuilderClassNameSuffix(com.sun.codemodel.JClass outerClass)
    • getUniqueClassName

      public String getUniqueClassName(String nodeName, com.fasterxml.jackson.databind.JsonNode node, com.sun.codemodel.JPackage _package)
    • getClassName

      public String getClassName(String nodeName, com.fasterxml.jackson.databind.JsonNode node, com.sun.codemodel.JPackage _package)