Skip to content

Commit 417bfa6

Browse files
committed
#25 - Rename methods on ClassDetails using the term "type"
1 parent 00e129f commit 417bfa6

File tree

8 files changed

+54
-51
lines changed

8 files changed

+54
-51
lines changed

src/main/java/org/hibernate/models/internal/ClassDetailsRegistryStandard.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ public void addClassDetails(ClassDetails classDetails) {
4848
public void addClassDetails(String name, ClassDetails classDetails) {
4949
classDetailsMap.put( name, classDetails );
5050

51-
if ( classDetails.getSuperType() != null ) {
52-
List<ClassDetails> subTypes = subTypeClassDetailsMap.get( classDetails.getSuperType().getName() );
51+
if ( classDetails.getSuperClass() != null ) {
52+
List<ClassDetails> subTypes = subTypeClassDetailsMap.get( classDetails.getSuperClass().getName() );
5353
//noinspection Java8MapApi
5454
if ( subTypes == null ) {
5555
subTypes = new ArrayList<>();
56-
subTypeClassDetailsMap.put( classDetails.getSuperType().getName(), subTypes );
56+
subTypeClassDetailsMap.put( classDetails.getSuperClass().getName(), subTypes );
5757
}
5858
subTypes.add( classDetails );
5959
}

src/main/java/org/hibernate/models/internal/ClassDetailsSupport.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ default <A extends Annotation> AnnotationUsage<A> getAnnotationUsage(AnnotationD
5252
return localUsage;
5353
}
5454

55-
if ( type.isInherited() && getSuperType() != null ) {
56-
return getSuperType().getAnnotationUsage( type );
55+
if ( type.isInherited() && getSuperClass() != null ) {
56+
return getSuperClass().getAnnotationUsage( type );
5757
}
5858

5959
return null;
@@ -63,8 +63,8 @@ default <A extends Annotation> AnnotationUsage<A> getAnnotationUsage(AnnotationD
6363
default <A extends Annotation> List<AnnotationUsage<A>> getRepeatedAnnotationUsages(AnnotationDescriptor<A> type) {
6464
final List<AnnotationUsage<A>> localUsages = AnnotationTargetSupport.super.getRepeatedAnnotationUsages( type );
6565

66-
if ( type.isInherited() && getSuperType() != null ) {
67-
final List<AnnotationUsage<A>> inheritedUsages = getSuperType().getRepeatedAnnotationUsages( type );
66+
if ( type.isInherited() && getSuperClass() != null ) {
67+
final List<AnnotationUsage<A>> inheritedUsages = getSuperClass().getRepeatedAnnotationUsages( type );
6868
return CollectionHelper.join( localUsages, inheritedUsages );
6969
}
7070

@@ -81,8 +81,8 @@ default <A extends Annotation> AnnotationUsage<A> getNamedAnnotationUsage(
8181
return localUsage;
8282
}
8383

84-
if ( type.isInherited() && getSuperType() != null ) {
85-
return getSuperType().getNamedAnnotationUsage( type, matchValue, attributeToMatch );
84+
if ( type.isInherited() && getSuperClass() != null ) {
85+
return getSuperClass().getNamedAnnotationUsage( type, matchValue, attributeToMatch );
8686
}
8787
return null;
8888
}

src/main/java/org/hibernate/models/internal/SimpleClassDetails.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import org.hibernate.models.internal.util.IndexedConsumer;
1717
import org.hibernate.models.spi.AnnotationDescriptor;
1818
import org.hibernate.models.spi.AnnotationUsage;
19-
import org.hibernate.models.spi.ClassBasedTypeDetails;
2019
import org.hibernate.models.spi.ClassDetails;
2120
import org.hibernate.models.spi.FieldDetails;
2221
import org.hibernate.models.spi.MethodDetails;
@@ -29,16 +28,16 @@
2928
*/
3029
public class SimpleClassDetails implements ClassDetails {
3130
private final Class<?> clazz;
32-
private final ClassDetails superTypeDetails;
31+
private final ClassDetails superClassDetails;
3332
private final TypeDetails genericSuperTypeDetails;
3433

3534
public SimpleClassDetails(Class<?> clazz) {
3635
this( clazz, ClassDetails.OBJECT_CLASS_DETAILS, null );
3736
}
3837

39-
public SimpleClassDetails(Class<?> clazz, ClassDetails superTypeDetails, TypeDetails genericSuperTypeDetails) {
38+
public SimpleClassDetails(Class<?> clazz, ClassDetails superClassDetails, TypeDetails genericSuperTypeDetails) {
4039
this.clazz = clazz;
41-
this.superTypeDetails = superTypeDetails;
40+
this.superClassDetails = superClassDetails;
4241
this.genericSuperTypeDetails = genericSuperTypeDetails;
4342
}
4443

@@ -53,8 +52,8 @@ public String getClassName() {
5352
}
5453

5554
@Override
56-
public ClassDetails getSuperType() {
57-
return superTypeDetails;
55+
public ClassDetails getSuperClass() {
56+
return superClassDetails;
5857
}
5958

6059
@Override
@@ -89,7 +88,7 @@ public boolean isRecord() {
8988
}
9089

9190
@Override
92-
public List<TypeDetails> getImplementedInterfaceTypes() {
91+
public List<TypeDetails> getImplementedInterfaces() {
9392
return Collections.emptyList();
9493
}
9594

src/main/java/org/hibernate/models/internal/dynamic/DynamicClassDetails.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class DynamicClassDetails extends AbstractAnnotationTarget implements Cla
2626
private final String name;
2727
private final String className;
2828
private final boolean isAbstract;
29-
private final ClassDetails superType;
29+
private final ClassDetails superClass;
3030
private final TypeDetails genericSuperType;
3131

3232
private List<FieldDetails> fields;
@@ -38,22 +38,26 @@ public DynamicClassDetails(String name, SourceModelBuildingContext buildingConte
3838
this( name, null, null, buildingContext );
3939
}
4040

41-
public DynamicClassDetails(String name, ClassDetails superType, TypeDetails genericSuperType, SourceModelBuildingContext buildingContext) {
42-
this( name, null, false, superType, genericSuperType, buildingContext );
41+
public DynamicClassDetails(
42+
String name,
43+
ClassDetails superClass,
44+
TypeDetails genericSuperType,
45+
SourceModelBuildingContext buildingContext) {
46+
this( name, null, false, superClass, genericSuperType, buildingContext );
4347
}
4448

4549
public DynamicClassDetails(
4650
String name,
4751
String className,
4852
boolean isAbstract,
49-
ClassDetails superType,
53+
ClassDetails superClass,
5054
TypeDetails genericSuperType,
5155
SourceModelBuildingContext buildingContext) {
5256
super( buildingContext );
5357
this.name = name;
5458
this.className = className;
5559
this.isAbstract = isAbstract;
56-
this.superType = superType;
60+
this.superClass = superClass;
5761
this.genericSuperType = genericSuperType;
5862
}
5963

@@ -83,8 +87,8 @@ public boolean isRecord() {
8387
}
8488

8589
@Override
86-
public ClassDetails getSuperType() {
87-
return superType;
90+
public ClassDetails getSuperClass() {
91+
return superClass;
8892
}
8993

9094
@Override
@@ -93,7 +97,7 @@ public TypeDetails getGenericSuperType() {
9397
}
9498

9599
@Override
96-
public List<TypeDetails> getImplementedInterfaceTypes() {
100+
public List<TypeDetails> getImplementedInterfaces() {
97101
// todo : do we need these for dynamic classes?
98102
return null;
99103
}

src/main/java/org/hibernate/models/internal/jandex/JandexClassDetails.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
public class JandexClassDetails extends AbstractAnnotationTarget implements ClassDetailsSupport {
4141
private final ClassInfo classInfo;
4242

43-
private final ClassDetails superType;
43+
private final ClassDetails superClass;
4444
private final TypeDetails genericSuperType;
4545
private final List<TypeDetails> implementedInterfaces;
4646
private final List<TypeVariableDetails> typeParameters;
@@ -53,7 +53,7 @@ public JandexClassDetails(ClassInfo classInfo, SourceModelBuildingContext buildi
5353
super( buildingContext );
5454
this.classInfo = classInfo;
5555

56-
this.superType = determineSuperType( classInfo, buildingContext );
56+
this.superClass = determineSuperType( classInfo, buildingContext );
5757
this.genericSuperType = determineGenericSuperType( classInfo, buildingContext );
5858
this.implementedInterfaces = determineInterfaces( classInfo, buildingContext );
5959
this.typeParameters = determineTypeParameters( classInfo, buildingContext );
@@ -143,8 +143,8 @@ public boolean isRecord() {
143143
}
144144

145145
@Override
146-
public ClassDetails getSuperType() {
147-
return superType;
146+
public ClassDetails getSuperClass() {
147+
return superClass;
148148
}
149149

150150
@Override
@@ -153,7 +153,7 @@ public TypeDetails getGenericSuperType() {
153153
}
154154

155155
@Override
156-
public List<TypeDetails> getImplementedInterfaceTypes() {
156+
public List<TypeDetails> getImplementedInterfaces() {
157157
return implementedInterfaces;
158158
}
159159

@@ -168,7 +168,7 @@ public boolean isImplementor(Class<?> checkType) {
168168
return true;
169169
}
170170

171-
if ( superType != null && superType.isImplementor( checkType ) ) {
171+
if ( superClass != null && superClass.isImplementor( checkType ) ) {
172172
return true;
173173
}
174174

src/main/java/org/hibernate/models/internal/jdk/JdkClassDetails.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class JdkClassDetails extends AbstractAnnotationTarget implements ClassDe
4040
private final String name;
4141
private final Class<?> managedClass;
4242

43-
private final ClassDetails superType;
43+
private final ClassDetails superClass;
4444
private TypeDetails genericSuperType;
4545
private List<TypeDetails> interfaces;
4646
private List<TypeVariableDetails> typeParameters;
@@ -67,10 +67,10 @@ public JdkClassDetails(
6767

6868
final Class<?> superclass = managedClass.getSuperclass();
6969
if ( superclass == null ) {
70-
superType = null;
70+
superClass = null;
7171
}
7272
else {
73-
superType = classDetailsRegistry.resolveClassDetails(
73+
superClass = classDetailsRegistry.resolveClassDetails(
7474
superclass.getName(),
7575
(n) -> JdkBuilders.buildClassDetailsStatic( superclass, buildingContext )
7676
);
@@ -109,8 +109,8 @@ public boolean isRecord() {
109109
}
110110

111111
@Override
112-
public ClassDetails getSuperType() {
113-
return superType;
112+
public ClassDetails getSuperClass() {
113+
return superClass;
114114
}
115115

116116
@Override
@@ -122,7 +122,7 @@ public TypeDetails getGenericSuperType() {
122122
}
123123

124124
@Override
125-
public List<TypeDetails> getImplementedInterfaceTypes() {
125+
public List<TypeDetails> getImplementedInterfaces() {
126126
if ( interfaces == null ) {
127127
interfaces = collectInterfaces();
128128
}

src/main/java/org/hibernate/models/spi/ClassDetails.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public interface ClassDetails extends AnnotationTarget, TypeVariableScope {
4141
*/
4242
ClassDetails VOID_OBJECT_CLASS_DETAILS = new SimpleClassDetails( Void.class );
4343

44+
@Override
45+
default Kind getKind() {
46+
return Kind.CLASS;
47+
}
48+
4449
/**
4550
* The name of the class.
4651
* <p/>
@@ -57,11 +62,6 @@ public interface ClassDetails extends AnnotationTarget, TypeVariableScope {
5762
*/
5863
String getClassName();
5964

60-
@Override
61-
default Kind getKind() {
62-
return Kind.CLASS;
63-
}
64-
6565
/**
6666
* Whether the {@linkplain Class}, if one, represented by this ClassDetails is
6767
* already loaded on the {@linkplain ClassLoader} used for {@linkplain ClassLoading loading}.
@@ -83,14 +83,14 @@ default Kind getKind() {
8383
/**
8484
* Details for the class that is the super type for this class.
8585
*/
86-
ClassDetails getSuperType();
86+
ClassDetails getSuperClass();
8787

8888
TypeDetails getGenericSuperType();
8989

9090
/**
9191
* Details for the interfaces this class implements.
9292
*/
93-
List<TypeDetails> getImplementedInterfaceTypes();
93+
List<TypeDetails> getImplementedInterfaces();
9494

9595
/**
9696
* Access to the type parameters associated with this class.
@@ -119,7 +119,7 @@ default TypeDetails resolveTypeVariable(String identifier) {
119119
}
120120
else {
121121
// assume parameterized
122-
final List<TypeVariableDetails> typeParameters = getSuperType().getTypeParameters();
122+
final List<TypeVariableDetails> typeParameters = getSuperClass().getTypeParameters();
123123
final List<TypeDetails> typeArguments = getGenericSuperType().asParameterizedType().getArguments();
124124
assert typeParameters.size() == typeArguments.size();
125125

@@ -140,8 +140,8 @@ default TypeDetails resolveTypeVariable(String identifier) {
140140
}
141141
}
142142

143-
if ( getSuperType() != null ) {
144-
return getSuperType().resolveTypeVariable( identifier );
143+
if ( getSuperClass() != null ) {
144+
return getSuperClass().resolveTypeVariable( identifier );
145145
}
146146

147147
return ClassBasedTypeDetails.OBJECT_TYPE_DETAILS;

src/test/java/org/hibernate/models/classes/InheritanceTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ private void basicRootTest(Index index) {
6565
assertThat( value2.getAnnotationUsage( ClassMarker.class ) ).isNull();
6666
assertThat( value2.getAnnotationUsage( Transient.class ) ).isNotNull();
6767

68-
assertThat( rootClassDetails.getSuperType() ).isNotNull();
69-
assertThat( rootClassDetails.getSuperType().toJavaClass() ).isEqualTo( Object.class );
68+
assertThat( rootClassDetails.getSuperClass() ).isNotNull();
69+
assertThat( rootClassDetails.getSuperClass().toJavaClass() ).isEqualTo( Object.class );
7070
}
7171

7272
@Test
@@ -113,8 +113,8 @@ private void basicTrunkTest(Index index) {
113113
assertThat( value4.getAnnotationUsage( ClassMarker.class ) ).isNull();
114114
assertThat( value4.getAnnotationUsage( Transient.class ) ).isNotNull();
115115

116-
assertThat( trunkClassDetails.getSuperType() ).isNotNull();
117-
assertThat( trunkClassDetails.getSuperType().toJavaClass() ).isEqualTo( RootClass.class );
116+
assertThat( trunkClassDetails.getSuperClass() ).isNotNull();
117+
assertThat( trunkClassDetails.getSuperClass().toJavaClass() ).isEqualTo( RootClass.class );
118118
}
119119

120120
@Test
@@ -184,7 +184,7 @@ private void testIsImplementor(Index index) {
184184

185185
final ClassDetails rootClassDetails = classDetailsRegistry.getClassDetails( RootClass.class.getName() );
186186
assertThat( rootClassDetails.isImplementor( Intf.class ) ).isFalse();
187-
assertThat( rootClassDetails.getSuperType() ).isSameAs( ClassDetails.OBJECT_CLASS_DETAILS );
187+
assertThat( rootClassDetails.getSuperClass() ).isSameAs( ClassDetails.OBJECT_CLASS_DETAILS );
188188

189189
final ClassDetails branchClassDetails = classDetailsRegistry.getClassDetails( BranchClass.class.getName() );
190190
assertThat( branchClassDetails.isImplementor( Intf.class ) ).isTrue();

0 commit comments

Comments
 (0)