18
18
19
19
import java .util .List ;
20
20
21
- import com .fasterxml .jackson .annotation .JsonIgnore ;
22
-
23
21
/**
24
22
* TypeName is similar to {@link java.lang.reflect.Type} in its most basic use case. The {@link #getName()} returns the package +
25
23
* class name tuple for the given type (i.e., the canonical type name).
26
24
* <p>
27
25
*
28
26
* This class also provides a number of methods that are typically found in {@link java.lang.Class} that can be used to avoid
29
27
* classloading resolution:
30
- * <li>{@link #getPackageName ()} and {@link #getClassName ()} - access to the package and simple class names.
31
- * <li>{@link #isPrimitive ()} and {@link #isArray ()} - access to flags that is typically found in {@link java.lang.Class}.
28
+ * <li>{@link #packageName ()} and {@link #className ()} - access to the package and simple class names.
29
+ * <li>{@link #primitive ()} and {@link #array ()} - access to flags that is typically found in {@link java.lang.Class}.
32
30
* <p>
33
31
*
34
32
* Additionally, this class offers a number of additional methods that are useful for handling generics:
35
- * <li>{@link #isGeneric ()} - true when this type is declared to include generics (i.e., has type arguments).
36
- * <li>{@link #isWildcard ()} - true if using wildcard generics usage.
37
- * <li>{@link #getTypeArguments ()} - access to generics / parametrized type information.
33
+ * <li>{@link #generic ()} - true when this type is declared to include generics (i.e., has type arguments).
34
+ * <li>{@link #wildcard ()} - true if using wildcard generics usage.
35
+ * <li>{@link #typeArguments ()} - access to generics / parametrized type information.
38
36
* <p>
39
37
*
40
38
* Finally, this class offers a number of methods that are helpful for code generation:
41
- * <li>{@link #getDeclaredName ()} and {@link #getFQName ()}.
39
+ * <li>{@link #declaredName ()} and {@link #fqName ()}.
42
40
*/
43
41
public interface TypeName extends Comparable <TypeName > {
44
42
@@ -47,64 +45,55 @@ public interface TypeName extends Comparable<TypeName> {
47
45
*
48
46
* @return the package name
49
47
*/
50
- @ JsonIgnore
51
- String getPackageName ();
48
+ String packageName ();
52
49
53
50
/**
54
51
* Functions the same as {@link Class#getSimpleName()}.
55
52
*
56
53
* @return the simple class name
57
54
*/
58
- @ JsonIgnore
59
- String getClassName ();
55
+ String className ();
60
56
61
57
/**
62
58
* Functions the same as {@link Class#isPrimitive()}.
63
59
*
64
60
* @return true if this type represents a primitive type.
65
61
*/
66
- @ JsonIgnore
67
- boolean isPrimitive ();
62
+ boolean primitive ();
68
63
69
64
/**
70
65
* Functions the same as {@link Class#isArray()}.
71
66
*
72
67
* @return true if this type represents a primitive array [].
73
68
*/
74
- @ JsonIgnore
75
- boolean isArray ();
69
+ boolean array ();
76
70
77
71
/**
78
72
* @return used to represent a generic (e.g., "Optional<CB>").
79
73
*/
80
- @ JsonIgnore
81
- boolean isGeneric ();
74
+ boolean generic ();
82
75
83
76
/**
84
77
* @return used to represent a wildcard (e.g., "? extends SomeType").
85
78
*/
86
- @ JsonIgnore
87
- boolean isWildcard ();
79
+ boolean wildcard ();
88
80
89
81
/**
90
82
* @return the type arguments of this type, if this type supports generics/parameterized type.
91
83
*/
92
- @ JsonIgnore
93
- List <TypeName > getTypeArguments ();
84
+ List <TypeName > typeArguments ();
94
85
95
86
/**
96
87
* Typically used as part of code-gen, when ".class" is tacked onto the suffix of what this returns.
97
88
*
98
89
* @return same as getName() unless the type is an array, and then will add "[]" to the return.
99
90
*/
100
- @ JsonIgnore
101
- String getDeclaredName ();
91
+ String declaredName ();
102
92
103
93
/**
104
94
* @return the fully qualified name which includes the use of generics/parameterized types, arrays, etc.
105
95
*/
106
- @ JsonIgnore
107
- String getFQName ();
96
+ String fqName ();
108
97
109
98
/**
110
99
* @return the base type name given the set package and class name, but not including the generics/parameterized types.
0 commit comments