Skip to content

Commit 932f2e1

Browse files
committed
remove ITypeInfo::wrapTypeName
1 parent 23148b7 commit 932f2e1

File tree

7 files changed

+11
-48
lines changed

7 files changed

+11
-48
lines changed

src/main/java/com/probejs/info/type/ITypeInfo.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ public interface ITypeInfo {
1111

1212
String getTypeName();
1313

14-
String wrapTypeName(String rawName);
15-
1614
ITypeInfo copy();
1715

1816
boolean assignableFrom(ITypeInfo info);

src/main/java/com/probejs/info/type/TypeInfoArray.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ public Class<?> getResolvedClass() {
6161

6262
@Override
6363
public String getTypeName() {
64-
return wrapTypeName(this.base.getTypeName());
65-
}
66-
67-
@Override
68-
public String wrapTypeName(String rawName) {
69-
return rawName + "[]";
64+
return this.base.getTypeName()+"[]";
7065
}
7166

7267
public void setBase(ITypeInfo type) {

src/main/java/com/probejs/info/type/TypeInfoClass.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ public String getTypeName() {
3636
return this.raw.getTypeName();
3737
}
3838

39-
@Override
40-
public String wrapTypeName(String rawName) {
41-
return rawName;
42-
}
43-
4439
@Override
4540
public ITypeInfo copy() {
4641
return new TypeInfoClass(raw);

src/main/java/com/probejs/info/type/TypeInfoParameterized.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99

1010
public class TypeInfoParameterized implements ITypeInfo {
1111

12-
public static boolean test(Type type) {
13-
return type instanceof ParameterizedType;
14-
}
15-
1612
private ITypeInfo rawType;
1713
private List<ITypeInfo> paramTypes;
18-
1914
public TypeInfoParameterized(Type type) {
2015
if (!test(type)) {
2116
throw new IllegalArgumentException("provided `type` is not an instance of ParameterizedType");
@@ -34,6 +29,10 @@ public TypeInfoParameterized(ITypeInfo rawType, List<? extends ITypeInfo> paramT
3429
this.paramTypes = new ArrayList<>(paramTypes);
3530
}
3631

32+
public static boolean test(Type type) {
33+
return type instanceof ParameterizedType;
34+
}
35+
3736
@Override
3837
public ITypeInfo getBaseType() {
3938
return rawType;
@@ -48,16 +47,14 @@ public List<ITypeInfo> getParamTypes() {
4847
return paramTypes;
4948
}
5049

51-
@Override
52-
public String getTypeName() {
53-
return wrapTypeName(this.rawType.getTypeName());
50+
public void setParamTypes(List<ITypeInfo> paramTypes) {
51+
this.paramTypes = paramTypes;
5452
}
5553

5654
@Override
57-
public String wrapTypeName(String rawName) {
58-
return String.format(
59-
"%s<%s>",
60-
rawName,
55+
public String getTypeName() {
56+
return String.format("%s<%s>",
57+
this.rawType.getTypeName(),
6158
paramTypes.stream().map(ITypeInfo::getTypeName).collect(Collectors.joining(", "))
6259
);
6360
}
@@ -86,10 +83,6 @@ public boolean assignableFrom(ITypeInfo info) {
8683
return false;
8784
}
8885

89-
public void setParamTypes(List<ITypeInfo> paramTypes) {
90-
this.paramTypes = paramTypes;
91-
}
92-
9386
public void setRawType(ITypeInfo rawType) {
9487
this.rawType = rawType;
9588
}

src/main/java/com/probejs/info/type/TypeInfoVariable.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,7 @@ public ITypeInfo getBaseType() {
3939

4040
@Override
4141
public String getTypeName() {
42-
return wrapTypeName(this.raw.getTypeName());
43-
}
44-
45-
@Override
46-
public String wrapTypeName(String rawName) {
47-
if (underscored) {
48-
return rawName + '_';
49-
}
50-
return rawName;
42+
return this.raw.getTypeName();
5143
}
5244

5345
@Override

src/main/java/com/probejs/info/type/TypeInfoWildcard.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ public String getTypeName() {
5656
return this.base.getTypeName();
5757
}
5858

59-
@Override
60-
public String wrapTypeName(String rawName) {
61-
return rawName;
62-
}
63-
6459
@Override
6560
public ITypeInfo copy() {
6661
return new TypeInfoWildcard(this.raw);

src/main/java/com/probejs/info/type/TypeLiteral.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ public String getTypeName() {
3030
return this.value;
3131
}
3232

33-
@Override
34-
public String wrapTypeName(String rawName) {
35-
return rawName;
36-
}
37-
3833
@Override
3934
public ITypeInfo copy() {
4035
return this;

0 commit comments

Comments
 (0)