Class SerdeSourceGenNames

java.lang.Object
io.micronaut.serde.processor.sourcegen.SerdeSourceGenNames

@Internal public final class SerdeSourceGenNames extends Object
Names of the user declarations that generated serde source refers to.
  • Method Details

    • escapeSourceWriterFormat

      public static String escapeSourceWriterFormat(String name)
      Escapes a declared name for the Java and Groovy source writers, which take the name as a JavaPoet format string rather than as an argument of one. A $ in a field or method name - legal in Java and used by generated models such as the Kubernetes $ref and $schema properties - otherwise reads as a placeholder and fails the generation.
      Parameters:
      name - The declared name
      Returns:
      The name as a format string that writes it back verbatim
    • requiresSourceWriterEscape

      public static boolean requiresSourceWriterEscape(String name)
      Whether a declared name needs escapeSourceWriterFormat(String).
      Parameters:
      name - The declared name
      Returns:
      Whether the name carries a format placeholder character