Skip to content

Commit 8fc9cdd

Browse files
committed
HBX-2974: Remove uses of class 'org.hibernate.tool.orm.jbt.internal.util.SpecialRootClass'
Signed-off-by: Koen Aers <[email protected]>
1 parent 6d208bd commit 8fc9cdd

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/PersistentClassWrapperFactory.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.hibernate.mapping.*;
1212
import org.hibernate.tool.orm.jbt.api.wrp.*;
1313
import org.hibernate.tool.orm.jbt.internal.util.DummyMetadataBuildingContext;
14-
import org.hibernate.tool.orm.jbt.internal.util.SpecialRootClass;
1514
import org.hibernate.tool.orm.jbt.internal.wrp.AbstractWrapper;
1615

1716
public class PersistentClassWrapperFactory {
@@ -153,12 +152,7 @@ public boolean isInstanceOfJoinedSubclass() {
153152

154153
@Override
155154
public PropertyWrapper getProperty() {
156-
if (!isInstanceOfSpecialRootClass()) {
157-
throw new RuntimeException("getProperty() is only allowed on SpecialRootClass");
158-
} else {
159-
Property p = ((SpecialRootClass)persistentClass).getProperty();
160-
return p == null ? null : PropertyWrapperFactory.createPropertyWrapper(p);
161-
}
155+
throw new RuntimeException("getProperty() is only allowed on SpecialRootClass");
162156
}
163157

164158
@Override
@@ -168,8 +162,6 @@ public void setTable(TableWrapper tableWrapper) {
168162
((RootClass)persistentClass).setTable(table);
169163
} else if (isInstanceOfJoinedSubclass()) {
170164
((JoinedSubclass)persistentClass).setTable(table);
171-
} else if (isInstanceOfSpecialRootClass()) {
172-
((SpecialRootClass)persistentClass).setTable(table);
173165
} else {
174166
throw new RuntimeException("Method 'setTable(Table)' is not supported.");
175167
}
@@ -199,12 +191,7 @@ public boolean isInstanceOfSpecialRootClass() {
199191

200192
@Override
201193
public PropertyWrapper getParentProperty() {
202-
if (!isInstanceOfSpecialRootClass()) {
203-
throw new RuntimeException("getParentProperty() is only allowed on SpecialRootClass");
204-
} else {
205-
Property p = ((SpecialRootClass)persistentClass).getParentProperty();
206-
return p == null ? null : PropertyWrapperFactory.createPropertyWrapper(p);
207-
}
194+
throw new RuntimeException("getParentProperty() is only allowed on SpecialRootClass");
208195
}
209196

210197
@Override

jbt/src/test/java/org/hibernate/tool/orm/jbt/api/wrp/PersistentClassWrapperTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.hibernate.tool.orm.jbt.internal.factory.TableWrapperFactory;
3131
import org.hibernate.tool.orm.jbt.internal.factory.ValueWrapperFactory;
3232
import org.hibernate.tool.orm.jbt.internal.util.DummyMetadataBuildingContext;
33-
import org.hibernate.tool.orm.jbt.internal.util.SpecialRootClass;
3433
import org.junit.jupiter.api.BeforeEach;
3534
import org.junit.jupiter.api.Test;
3635

@@ -57,7 +56,6 @@ public void beforeEach() throws Exception {
5756
joinedSubclassWrapper = PersistentClassWrapperFactory.createPersistentClassWrapper(joinedSubclassTarget);
5857
property = PropertyWrapperFactory.createPropertyWrapper();
5958
property.setPersistentClass(rootClassWrapper);
60-
specialRootClassTarget = new SpecialRootClass((Property)property.getWrappedObject());
6159
specialRootClassWrapper = PersistentClassWrapperFactory.createSpecialRootClassWrapper(property);
6260
specialRootClassTarget = (PersistentClass)specialRootClassWrapper.getWrappedObject();
6361
}

0 commit comments

Comments
 (0)