java.lang.Object
io.avaje.inject.generator.ProcessorUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringboxedPrimitive(String type) Returns boxed type if type string is primitive, otherwise return the input unchangedstatic StringcommonParent(String firstPkg, String secondPkg) Return the common parent package between two classes/packages.static StringGet the enclosed type from a nested class, or return the type itself if not nested.static booleanhasAnnotationWithName(Element element, String simpleName) Check if element has an annotation with a simple name that matches the given short namestatic booleanisPrimitive(String type) Return true if type string is of a primitive typestatic booleanisVarArg(VariableElement element, int position) Determine if a VariableElement is a varargs parameterstatic StringGet Package from a given fqn stringstatic StringsanitizeImports(String input) Sanitize an import string to remove invalid charactersstatic StringGet short type from a given fqn string.static StringtrimAnnotations(String input) Remove all annotations and their values from a string.
-
Method Details
-
boxedPrimitive
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
Return true if type string is of a primitive type- Parameters:
type-- Returns:
- true if type represents a primitive
-
packageOf
Get Package from a given fqn string- Parameters:
fqn- the fully qualified type string- Returns:
- the package of the type
-
shortType
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
Remove all annotations and their values from a string.- Parameters:
input- string to remove annotations from- Returns:
- input free of annotations
-
commonParent
Return the common parent package between two classes/packages.- Parameters:
firstPkg- first class/package stringsecondPkg- second class/package string- Returns:
- the common package between the two classes
-
isVarArg
Determine if a VariableElement is a varargs parameter- Parameters:
element- the parameter elementposition- the position of the parameter in the signature- Returns:
- true if element is a varargs parameter, false otherwise
-
hasAnnotationWithName
Check if element has an annotation with a simple name that matches the given short name- Parameters:
element- element to checksimpleName- the simple name of the target annotation- Returns:
- true if a matching annotation is present
-
sanitizeImports
Sanitize an import string to remove invalid characters- Parameters:
input- input to sanitize- Returns:
- sanitized import statement
-
extractEnclosingFQN
Get the enclosed type from a nested class, or return the type itself if not nested. (i.e.io.package.Top.Nestedwill becomeio.package.Top)- Parameters:
fqn- fully qualified type to extract- Returns:
- sanitized import statement
-