Skip to content

Commit 594d396

Browse files
committed
GH-1153 - Removed deprecated FormatableType.
1 parent 5f72562 commit 594d396

File tree

3 files changed

+20
-150
lines changed

3 files changed

+20
-150
lines changed

spring-modulith-core/src/main/java/org/springframework/modulith/core/DependencyType.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@ public enum DependencyType {
4444
*/
4545
USES_COMPONENT {
4646

47-
/*
48-
* (non-Javadoc)
49-
* @see org.springframework.modulith.model.Module.DependencyType#format(org.springframework.modulith.model.FormatableJavaClass, org.springframework.modulith.model.FormatableJavaClass)
50-
*/
51-
@Override
52-
public String format(FormatableType source, FormatableType target) {
53-
return String.format("Component %s using %s", source.getAbbreviatedFullName(), target.getAbbreviatedFullName());
54-
}
55-
5647
/*
5748
* (non-Javadoc)
5849
* @see org.springframework.modulith.core.DependencyType#format(org.springframework.modulith.core.FormattableType, org.springframework.modulith.core.FormattableType)
@@ -68,16 +59,6 @@ public String format(FormattableType source, FormattableType target) {
6859
*/
6960
ENTITY {
7061

71-
/*
72-
* (non-Javadoc)
73-
* @see org.springframework.modulith.model.Module.DependencyType#format(org.springframework.modulith.model.FormatableJavaClass, org.springframework.modulith.model.FormatableJavaClass)
74-
*/
75-
@Override
76-
public String format(FormatableType source, FormatableType target) {
77-
return String.format("Entity %s depending on %s", source.getAbbreviatedFullName(),
78-
target.getAbbreviatedFullName());
79-
}
80-
8162
/*
8263
* (non-Javadoc)
8364
* @see org.springframework.modulith.core.DependencyType#format(org.springframework.modulith.core.FormattableType, org.springframework.modulith.core.FormattableType)
@@ -95,16 +76,6 @@ public String format(FormattableType source, FormattableType target) {
9576
*/
9677
EVENT_LISTENER {
9778

98-
/*
99-
* (non-Javadoc)
100-
* @see org.springframework.modulith.model.Module.DependencyType#format(org.springframework.modulith.model.FormatableJavaClass, org.springframework.modulith.model.FormatableJavaClass)
101-
*/
102-
@Override
103-
public String format(FormatableType source, FormatableType target) {
104-
return String.format("%s listening to events of type %s", source.getAbbreviatedFullName(),
105-
target.getAbbreviatedFullName());
106-
}
107-
10879
/*
10980
* (non-Javadoc)
11081
* @see org.springframework.modulith.core.DependencyType#format(org.springframework.modulith.core.FormattableType, org.springframework.modulith.core.FormattableType)
@@ -127,15 +98,6 @@ public DependencyType defaultOr(Supplier<DependencyType> supplier) {
12798
return supplier.get();
12899
}
129100

130-
/*
131-
* (non-Javadoc)
132-
* @see org.springframework.modulith.model.Module.DependencyType#format(org.springframework.modulith.model.FormatableJavaClass, org.springframework.modulith.model.FormatableJavaClass)
133-
*/
134-
@Override
135-
public String format(FormatableType source, FormatableType target) {
136-
return String.format("%s depending on %s", source.getAbbreviatedFullName(), target.getAbbreviatedFullName());
137-
}
138-
139101
/*
140102
* (non-Javadoc)
141103
* @see org.springframework.modulith.core.DependencyType#format(org.springframework.modulith.core.FormattableType, org.springframework.modulith.core.FormattableType)
@@ -175,12 +137,6 @@ static DependencyType forDependency(Dependency dependency) {
175137
return forParameter(dependency.getTargetClass());
176138
}
177139

178-
/**
179-
* @deprecated since 1.3, prefer {@link #format(FormattableType, FormattableType)}.
180-
*/
181-
@Deprecated
182-
public abstract String format(FormatableType source, FormatableType target);
183-
184140
public abstract String format(FormattableType source, FormattableType target);
185141

186142
/**

spring-modulith-core/src/main/java/org/springframework/modulith/core/FormatableType.java

Lines changed: 0 additions & 88 deletions
This file was deleted.

spring-modulith-core/src/main/java/org/springframework/modulith/core/FormattableType.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@
3535
*
3636
* @author Oliver Drotbohm
3737
*/
38-
@SuppressWarnings("deprecation")
39-
public class FormattableType extends FormatableType {
38+
public class FormattableType {
4039

4140
private static final Map<String, FormattableType> CACHE = new ConcurrentHashMap<>();
4241

4342
private final String type;
4443
private final Supplier<String> abbreviatedName;
4544

4645
/**
47-
* Creates a new {@link FormatableType} for the given source {@link String} and lazily computed abbreviated name.
46+
* Creates a new {@link FormattableType} for the given source {@link String} and lazily computed abbreviated name.
4847
*
4948
* @param type must not be {@literal null} or empty.
5049
* @param abbreviatedName must not be {@literal null}.
@@ -59,7 +58,7 @@ private FormattableType(String type, Supplier<String> abbreviatedName) {
5958
}
6059

6160
/**
62-
* Creates a new {@link FormatableType} for the given fully-qualified type name.
61+
* Creates a new {@link FormattableType} for the given fully-qualified type name.
6362
*
6463
* @param type must not be {@literal null} or empty.
6564
*/
@@ -81,7 +80,7 @@ private FormattableType(String type) {
8180
}
8281

8382
/**
84-
* Creates a new {@link FormatableType} for the given {@link JavaClass}.
83+
* Creates a new {@link FormattableType} for the given {@link JavaClass}.
8584
*
8685
* @param type must not be {@literal null}.
8786
* @return will never be {@literal null}.
@@ -94,7 +93,7 @@ public static FormattableType of(JavaClass type) {
9493
}
9594

9695
/**
97-
* Creates a new {@link FormatableType} for the given {@link Class}.
96+
* Creates a new {@link FormattableType} for the given {@link Class}.
9897
*
9998
* @param type must not be {@literal null}.
10099
* @return will never be {@literal null}.
@@ -119,20 +118,23 @@ public static String format(Iterable<JavaClass> types) {
119118
.collect(Collectors.joining(", "));
120119
}
121120

122-
/*
123-
* (non-Javadoc)
124-
* @see org.springframework.modulith.core.FormatableType#getAbbreviatedFullName()
121+
/**
122+
* Returns the abbreviated (i.e. every package fragment reduced to its first character) full name, e.g.
123+
* {@code com.acme.MyType} will result in {@code c.a.MyType}.
124+
*
125+
* @return will never be {@literal null}.
125126
*/
126-
@Override
127127
public String getAbbreviatedFullName() {
128128
return abbreviatedName.get();
129129
}
130130

131-
/*
132-
* (non-Javadoc)
133-
* @see org.springframework.modulith.core.FormatableType#getAbbreviatedFullName(org.springframework.modulith.core.ApplicationModule)
131+
/**
132+
* Returns the abbreviated full name of the type abbreviating only the part of the given {@link ApplicationModule}'s
133+
* base package.
134+
*
135+
* @param module can be {@literal null}.
136+
* @return will never be {@literal null}.
134137
*/
135-
@Override
136138
public String getAbbreviatedFullName(@Nullable ApplicationModule module) {
137139

138140
if (module == null) {
@@ -161,11 +163,11 @@ public String getAbbreviatedFullName(@Nullable ApplicationModule module) {
161163
.concat(ClassUtils.getShortName(type));
162164
}
163165

164-
/*
165-
* (non-Javadoc)
166-
* @see org.springframework.modulith.core.FormatableType#getFullName()
166+
/**
167+
* Returns the type's full name.
168+
*
169+
* @return will never be {@literal null}.
167170
*/
168-
@Override
169171
public String getFullName() {
170172
return type.replace("$", ".");
171173
}

0 commit comments

Comments
 (0)