12
12
public abstract class FormatterType <T extends ITypeInfo > {
13
13
14
14
public static final Map <Class <? extends ITypeInfo >, Function <ITypeInfo , FormatterType <?>>> REGISTRIES = new HashMap <>();
15
- public static final Dummy DUMMY_ANY = new Dummy ("any" );
15
+ public static final Literal LITERAL_ANY = new Literal ("any" );
16
16
protected boolean underscored = false ;
17
17
18
18
static {
@@ -33,7 +33,7 @@ public static FormatterType<? extends ITypeInfo> of(ITypeInfo tInfo, boolean all
33
33
Class <?> rawClass = tInfo .getResolvedClass ();
34
34
Function <ITypeInfo , String > special = NameResolver .specialTypeFormatters .get (rawClass );
35
35
if (special != null ) {
36
- return new Dummy (special .apply (tInfo ));
36
+ return new Literal (special .apply (tInfo ));
37
37
}
38
38
}
39
39
//general
@@ -42,7 +42,7 @@ public static FormatterType<? extends ITypeInfo> of(ITypeInfo tInfo, boolean all
42
42
return builder .apply (tInfo );
43
43
}
44
44
//fallback
45
- return DUMMY_ANY ;
45
+ return LITERAL_ANY ;
46
46
}
47
47
48
48
/**
@@ -80,17 +80,17 @@ public FormatterType<T> underscored(Predicate<ITypeInfo> predicate) {
80
80
81
81
public abstract String format ();
82
82
83
- public static class Dummy extends FormatterType <ITypeInfo > {
83
+ public static class Literal extends FormatterType <TypeLiteral > {
84
84
85
85
private final String value ;
86
86
87
- private Dummy (String value ) {
87
+ public Literal (String value ) {
88
88
this .value = value ;
89
89
}
90
90
91
91
@ Override
92
- public ITypeInfo getInfo () {
93
- return null ;
92
+ public TypeLiteral getInfo () {
93
+ return new TypeLiteral ( this . value ) ;
94
94
}
95
95
96
96
@ Override
@@ -105,7 +105,6 @@ public static class Clazz extends FormatterType<ITypeInfo> {
105
105
/**
106
106
* use {@link FormatterType#of(ITypeInfo)} instead
107
107
*/
108
- @ Deprecated
109
108
public Clazz (ITypeInfo tInfo ) {
110
109
this .tInfo = (TypeInfoClass ) tInfo ;
111
110
}
@@ -131,7 +130,6 @@ public static class Wildcard extends FormatterType<ITypeInfo> {
131
130
/**
132
131
* use {@link FormatterType#of(ITypeInfo)} instead
133
132
*/
134
- @ Deprecated
135
133
public Wildcard (ITypeInfo tInfo ) {
136
134
this .tInfo = (TypeInfoWildcard ) tInfo ;
137
135
}
@@ -153,7 +151,6 @@ public static class Variable extends FormatterType<ITypeInfo> {
153
151
/**
154
152
* use {@link FormatterType#of(ITypeInfo)} instead
155
153
*/
156
- @ Deprecated
157
154
public Variable (ITypeInfo tInfo ) {
158
155
this .tInfo = (TypeInfoVariable ) tInfo ;
159
156
}
@@ -188,7 +185,6 @@ public static class Array extends FormatterType<ITypeInfo> {
188
185
/**
189
186
* use {@link FormatterType#of(ITypeInfo)} instead
190
187
*/
191
- @ Deprecated
192
188
public Array (ITypeInfo tInfo ) {
193
189
this .tInfo = (TypeInfoArray ) tInfo ;
194
190
}
@@ -200,7 +196,7 @@ public ITypeInfo getInfo() {
200
196
201
197
@ Override
202
198
public String format () {
203
- return FormatterType .of (this .tInfo .getBaseType ()).format () + "[]" ;
199
+ return FormatterType .of (this .tInfo .getBaseType ()).underscored ( this . underscored ). format () + "[]" ;
204
200
}
205
201
}
206
202
@@ -210,7 +206,6 @@ public static class Parameterized extends FormatterType<ITypeInfo> {
210
206
/**
211
207
* use {@link FormatterType#of(ITypeInfo)} instead
212
208
*/
213
- @ Deprecated
214
209
public Parameterized (ITypeInfo tInfo ) {
215
210
this .tInfo = (TypeInfoParameterized ) tInfo ;
216
211
}
@@ -227,7 +222,6 @@ public String format() {
227
222
this .tInfo .getParamTypes ()
228
223
.stream ()
229
224
.map (FormatterType ::of )
230
- .map (fmtr -> fmtr .underscored (false ))
231
225
.map (FormatterType ::format )
232
226
.collect (Collectors .joining (", " ))
233
227
);
0 commit comments