Class ProcessorUtils

java.lang.Object
io.avaje.inject.generator.ProcessorUtils

@Generated("avaje-prism-generator") public final class ProcessorUtils extends Object
  • Method Details

    • boxedPrimitive

      public static String boxedPrimitive(String type)
      Returns boxed type if type string is primitive, otherwise return the input unchanged
      Parameters:
      type - type string
      Returns:
      boxed type string if type is primitive
    • isPrimitive

      public static boolean isPrimitive(String type)
      Return true if type string is of a primitive type
      Parameters:
      type -
      Returns:
      true if type represents a primitive
    • packageOf

      public static String packageOf(String fqn)
      Get Package from a given fqn string
      Parameters:
      fqn - the fully qualified type string
      Returns:
      the package of the type
    • shortType

      public static String shortType(String fqn)
      Get short type from a given fqn string. Nested Classes will have parent classes as part of the short name
      Parameters:
      fqn - the fully qualified type string
      Returns:
      the short type
    • trimAnnotations

      public static String trimAnnotations(String input)
      Remove all annotations and their values from a string.
      Parameters:
      input - string to remove annotations from
      Returns:
      input free of annotations
    • commonParent

      public static String commonParent(String firstPkg, String secondPkg)
      Return the common parent package between two classes/packages.
      Parameters:
      firstPkg - first class/package string
      secondPkg - second class/package string
      Returns:
      the common package between the two classes
    • isVarArg

      public static boolean isVarArg(VariableElement element, int position)
      Determine if a VariableElement is a varargs parameter
      Parameters:
      element - the parameter element
      position - the position of the parameter in the signature
      Returns:
      true if element is a varargs parameter, false otherwise
    • hasAnnotationWithName

      public static boolean hasAnnotationWithName(Element element, String simpleName)
      Check if element has an annotation with a simple name that matches the given short name
      Parameters:
      element - element to check
      simpleName - the simple name of the target annotation
      Returns:
      true if a matching annotation is present
    • sanitizeImports

      public static String sanitizeImports(String input)
      Sanitize an import string to remove invalid characters
      Parameters:
      input - input to sanitize
      Returns:
      sanitized import statement
    • extractEnclosingFQN

      public static String extractEnclosingFQN(String fqn)
      Get the enclosed type from a nested class, or return the type itself if not nested. (i.e. io.package.Top.Nested will become io.package.Top)
      Parameters:
      fqn - fully qualified type to extract
      Returns:
      sanitized import statement