Class NameFormat

java.lang.Object
no.sikt.graphitron.generators.codebuilding.NameFormat

public class NameFormat extends Object
Helper methods for formatting names.
  • Field Details

  • Constructor Details

    • NameFormat

      public NameFormat()
  • Method Details

    • asGetMethodVariableName

      @NotNull public static @NotNull String asGetMethodVariableName(String source, String fieldName)
      Returns:
      Inputs formatted as a get call, but without the get element of the string.
    • asCountMethodName

      @NotNull public static @NotNull String asCountMethodName(String field, String container)
      Returns:
      This field and containing type formatted as a counting query method name.
    • asQueryMethodName

      @NotNull public static @NotNull String asQueryMethodName(String field, String container)
      Returns:
      This field and containing type formatted as a fetch query method name.
    • asEntityQueryMethodName

      @NotNull public static @NotNull String asEntityQueryMethodName(String prefix)
      Returns:
      This field and containing type formatted as an entity fetch query method name.
    • asTypeResolverMethodName

      @NotNull public static @NotNull String asTypeResolverMethodName(String target)
      Returns:
      Format this name as a method name for a type resolver.
    • asGetMethodName

      @NotNull public static @NotNull String asGetMethodName(String field, String type)
      Returns:
      Inputs formatted as a get call.
    • asGetMethodName

      @NotNull public static @NotNull String asGetMethodName(String field)
      Returns:
      Inputs formatted as a get call.
    • asQueryClass

      @NotNull public static @NotNull String asQueryClass(String s)
      Returns:
      Name formatted as a query class name.
    • asRecordMapperClass

      @NotNull public static @NotNull String asRecordMapperClass(String s, boolean isJavaRecord, boolean isInput)
      Returns:
      Name formatted as a record mapper class name.
    • interfaceOrUnionQueryName

      public static String interfaceOrUnionQueryName(String implementationName, String interfaceName)
      Returns:
      Interface method naming for this interface implementation.
    • asNodeQueryName

      @NotNull public static @NotNull String asNodeQueryName(String s)
      Returns:
      Field type formatted as a node interface method call.
    • asEntitiesQueryName

      public static String asEntitiesQueryName(String s)
    • asListedName

      @NotNull public static @NotNull String asListedName(String s)
      Returns:
      Input formatted as a list version of itself.
    • asListedNameIf

      @NotNull public static @NotNull String asListedNameIf(String s, boolean condition)
      Returns:
      Input formatted as a list version of itself, if condition is true.
    • asRecordName

      @NotNull public static @NotNull String asRecordName(String s)
      Returns:
      Format this string as a record naming pattern.
    • recordTransformMethod

      @NotNull public static @NotNull String recordTransformMethod(String s, boolean isJavaRecord, boolean isInput)
      Returns:
      Format this string as a record transform method naming pattern.
    • recordTransformMethod

      @NotNull public static @NotNull String recordTransformMethod(boolean isJavaRecord, boolean isInput)
      Returns:
      Format a record transform method naming pattern.
    • recordValidateMethod

      @NotNull public static @NotNull String recordValidateMethod()
      Returns:
      Format a record validation method naming pattern.
    • namedIteratorPrefixIf

      @NotNull public static @NotNull String namedIteratorPrefixIf(String s, boolean condition)
      Returns:
      Input formatted as an iterable name, if condition is true.
    • asListedRecordName

      @NotNull public static @NotNull String asListedRecordName(String name)
      Returns:
      Format this string as an iterable record naming pattern.
    • asListedRecordNameIf

      @NotNull public static @NotNull String asListedRecordNameIf(String name, boolean condition)
      Returns:
      Format this string as a record naming pattern. It is iterable if condition is set to true
    • toCamelCase

      public static String toCamelCase(String name)
      Camel case conversion with special handling for numbers.